Showing posts with label Tutorial Laravel. Show all posts
Showing posts with label Tutorial Laravel. Show all posts
Master Detail ( Laravel CRUD V2 )
kangopik
In laravel CRUD and CMS v2 , master detail is feature for filtering rows detail by spesific field , ID from master table.
Example you have rows master detail :
The picture showing you where invoce table related to invoiceline table with 'InvoiceId' key relation.
We used call it "One to Many " relation, where every row on table invoice will have one or more rows detail in invoiceline table .
Ok let's turn the logic into real application .
Step 1
- Create 2 modules , Invoice and Invoiceline ( please see previous tutorial creating module )
http://mangsoft.blogspot.com/2014/03/create-simple-crud-laravel-41-using.html
Step 2 .
Create new menu for Invoice module
Step 3
Edit module Invoice and go to master detail tab :
Fill in form field as illustrated image above . then save master detail
Now go to Invoice module , you will see new menu at dropdown button at every rows.
Test it by clicking link 'View orders detail' .
it will bring you to invoiceline module , with header information about master row details.
It's Easy right ? so why you dont try it by your self .
View Demo Page
Good Luck !!
Example you have rows master detail :
The picture showing you where invoce table related to invoiceline table with 'InvoiceId' key relation.
We used call it "One to Many " relation, where every row on table invoice will have one or more rows detail in invoiceline table .
Ok let's turn the logic into real application .
Step 1
- Create 2 modules , Invoice and Invoiceline ( please see previous tutorial creating module )
http://mangsoft.blogspot.com/2014/03/create-simple-crud-laravel-41-using.html
Step 2 .
Create new menu for Invoice module
Step 3
Edit module Invoice and go to master detail tab :
Fill in form field as illustrated image above . then save master detail
Now go to Invoice module , you will see new menu at dropdown button at every rows.
Test it by clicking link 'View orders detail' .
it will bring you to invoiceline module , with header information about master row details.
It's Easy right ? so why you dont try it by your self .
View Demo Page
Good Luck !!
7:21 PM
Tutorial Laravel
Formating rows on grid table
kangopik
Now let's continue our tutorial , in this section we will guide you to format rows grid at module generated by LCRUD v2.
After created module , app creating folowing files :
Now open index.blade.php with your favorite php editor
at line 89 - 100 , you should find code html as shown bellow :
oke , lets understanding what's code does
example
you have table with following items :
Id (int) , name ( varchar ) , email ( varchar ) , status ( enum '1','0' )
now let format emails as link mailto and status ( if 1 show Active and 0 inactive )
After created module , app creating folowing files :
- protected
- app
- controllers
- YourmoduleController.php
- models
- Yourmodule.php
- views
- yourmodule
- index.blade.php
- form.blade.php
- view.blade.php
- yourmodule
- controllers
- app
Now open index.blade.php with your favorite php editor
at line 89 - 100 , you should find code html as shown bellow :
@foreach ($tableGrid as $field) @if($field['view'] =='1') <td> @if($field['attribute']['image']['active'] =='1') <img src="{{ asset($field['attribute']['image']['path'].'/'.$row->$field['field'])}}" width="50" /> @else {{ $row->$field['field'] }} @endif </td> @endif @endforeach
example
you have table with following items :
Id (int) , name ( varchar ) , email ( varchar ) , status ( enum '1','0' )
now let format emails as link mailto and status ( if 1 show Active and 0 inactive )
@foreach ($tableGrid as $field) @if($field['view'] =='1') <td> @if($field['attribute']['image']['active'] =='1') <img src="{{ asset($field['attribute']['image']['path'].'/'.$row->$field['field'])}}" width="50" /> @elseif($field['field'] == 'email') <!-- formating email as link --> <a href="mailto:{{ $row->email }}"> {{ $row->email }} </a> @elseif($field['field'] == 'status') <!-- Formating status , set active or inactive --> {{ ($row->status == 1 ? 'Active' : 'Inactive') }} @else {{ $row->$field['field'] }} @endif </td> @endif @endforeach
6:27 AM
Tutorial Laravel
Working with MySQL Statement
kangopik
This is heart of your module , from this query module are built up .
remember if you want to display/show any field from table database , you
need to include field on your query
Query are splited to 3 part , SQL select , SQL Where , SQL Group
Ilustration you have table customers with following field :
EmployeeId, FirstName , LastName , Title, ReportsTo, BirthDate ,HireDate, Address ,City , State , Country , PostalCode , Phone , Fax , Email.
At the firs time creating module using 'employee' table , generator will create single query line :
SQL Select :
Why LCRUD Creating automatic " WHERE employee.EmployeeId IS NOT NULL " ? this is for prevent when users submit search form
The result will look like :
We plan to change "ReportsTo" to employee name .
Query are splited to 3 part , SQL select , SQL Where , SQL Group
Ilustration you have table customers with following field :
CREATE TABLE `customer` ( `CustomerId` int(11) NOT NULL AUTO_INCREMENT, `FirstName` varchar(40) CHARACTER SET utf8 NOT NULL, `LastName` varchar(20) CHARACTER SET utf8 NOT NULL, `Company` varchar(80) CHARACTER SET utf8 DEFAULT NULL, `Address` varchar(70) CHARACTER SET utf8 DEFAULT NULL, `City` varchar(40) CHARACTER SET utf8 DEFAULT NULL, `State` varchar(40) CHARACTER SET utf8 DEFAULT NULL, `Country` varchar(40) CHARACTER SET utf8 DEFAULT NULL, `PostalCode` varchar(10) CHARACTER SET utf8 DEFAULT NULL, `Phone` varchar(24) CHARACTER SET utf8 DEFAULT NULL, `Fax` varchar(24) CHARACTER SET utf8 DEFAULT NULL, `Email` varchar(60) CHARACTER SET utf8 NOT NULL, `SupportRepId` int(11) DEFAULT NULL, PRIMARY KEY (`CustomerId`), KEY `IFK_CustomerSupportRepId` (`SupportRepId`) ) ENGINE=MyISAM AUTO_INCREMENT=60 DEFAULT CHARSET=latin1
EmployeeId, FirstName , LastName , Title, ReportsTo, BirthDate ,HireDate, Address ,City , State , Country , PostalCode , Phone , Fax , Email.
At the firs time creating module using 'employee' table , generator will create single query line :
SQL Select :
SELECT employee,* FROM employeeSQL Where :
WHERE employee.EmployeeId IS NOT NULLSQL Group :
Why LCRUD Creating automatic " WHERE employee.EmployeeId IS NOT NULL " ? this is for prevent when users submit search form
The result will look like :
Join Query
Now lets trying making simple join query , as you can see "ReportsTo" field is displaying number reference to EmployeeIdWe plan to change "ReportsTo" to employee name .
SELECT employee.*, b.FirstName AS ReportName FROM employee LEFT JOIN employee AS b ON employee.EmployeeId = b.ReportsToSave this new query statment . next go to table tab hide ReportsTo field and display ReportName
10:34 AM
Tutorial Laravel
Create Pages Using LCRUD v.2
kangopik
Page CMS is new features in Laravel CRUD & Administrator version 2.0.
This feature allow you to create page for frontend ( Public ) or Private.
Before you begin creating pages , you have to know that LCRUD create file everytime you create pages , its mean you have full control to insert everything in content such tag php , css , javasript etc .
Lets start :
Go to Tools > page CMS > click button create
This feature allow you to create page for frontend ( Public ) or Private.
Before you begin creating pages , you have to know that LCRUD create file everytime you create pages , its mean you have full control to insert everything in content such tag php , css , javasript etc .
Lets start :
Go to Tools > page CMS > click button create
11:33 PM
Tutorial Laravel
Create Simple CRUD ( Laravel 4.1 ) using LCRUD
kangopik
Before you create module , you have to create table for module you will created . this app doest have feature to create table database , so you need phpmyadmin or other mysql tools for creating table
11:32 PM
Tutorial Laravel
Installing LCRUD version 2
kangopik
Before you install LCRUD V2 , make sure your Server meet minimun requirement
To be able to install LC v2 , you must have the following items installed :
- Apache, nginx, or another compatible web server.
- PHP 5.3. >> Higher
- MySQL Database server
- Module Re_write server ( .htaccess feature )
- PDO module
11:28 PM
Tutorial Laravel
Subscribe to:
Posts
(
Atom
)






