0% found this document useful (0 votes)
71 views

Project Overview: PHP Frameworks

The document provides an overview of the Laravel PHP framework, including its features and how to set up a basic Laravel project. Some key points include: - Laravel is an open-source PHP web framework used for building web applications. - Setting up a Laravel project involves installing Composer, creating a project directory, and configuring files like .env for database connection. - The document outlines creating basic routes and controllers to display views for a home page and admin dashboard. It also describes making a database migration to store admin users.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
71 views

Project Overview: PHP Frameworks

The document provides an overview of the Laravel PHP framework, including its features and how to set up a basic Laravel project. Some key points include: - Laravel is an open-source PHP web framework used for building web applications. - Setting up a Laravel project involves installing Composer, creating a project directory, and configuring files like .env for database connection. - The document outlines creating basic routes and controllers to display views for a home page and admin dashboard. It also describes making a database migration to store admin users.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

Laravel

https://laravel.com/docs/8.x

Project Overview PHP Frameworks:


1. Multiple Language 1. Laravel
2. Order Tracking 2. CodeIgniter
3. Stock management 3. CakePHP
4. User role management 4. Symfony
5. Socialite 5. Zend
6. Return Order / Coupon
7. Facebook comment https://beebom.com/best-free-php-frameworks/
8. Product Share on social media
9. Discount/ Buy one get one/ Flash deal etc. Why use Laravel:?
10. Payment Gateway Stripe/ Mollie/ PayPal ● Login system
11. Mailing ● Registration system
12. Reports ● Forgot pass system
13. Wishlist ● Mailing system
14. JWT & Task Scheduling
15. CronJob & Task Scheduling
16. Telescope Our Youtube Channel: “BCS Wadud”
17. Database backup 1. Subscribe must
18. Search 2. Like, Comment and Share
Reason:
1. Project, 2. Clear Concept, 3. Reusability, 4. Database

Pre RequireMent:
Laravel, PHP, MySQL, OOP, HTML, CSS, JS

Tools:
1. Download and install xampp/Wamp/Mamp (PHP >= 7.4)
2. IDE(Sublime, Brackets, Visual Studio, Atom)
3. Download composer and install
For update: composer self-update
4. Favorite food and Drink

Section:
1. Admin: Product added, Product delete, Product description, Category add, and Category delete,
Brand add and delete, Slider change.
2. User: Just buy product and SignUp also and Wishlist added

Template ~ E-Shopper:
https://drive.google.com/file/d/1xXHplfzRzk_-fiRs8lEQjjFvP7Mf_WPO/view?usp=sharing
Dashboard:
https://drive.google.com/file/d/1EGUx1iOcfwbg1N0RJ4YRSNbRN1y34S9g/view?usp=sharing
1. XAMPP > htdocs > Write above the URL: cmd
2. composer create-project --prefer-dist laravel/laravel elaravel
3. XAMPP > htdocs > elaravel > Write above the URL: cmd > php artisan serve
4. http://127.0.0.1:8000 or http://localhost:8000

5. Open Sublime with elaravel and Go resources > views > welcome.blade.php

6. Public > frontend > CSS, Js Link: {{asset('frontend/')}} & Images Link: {{URL::to('frontend/')}}

7. Views > pages > home_content.blade.php > (features_items to recommended_items)


@extends('welcome/layout')
@section('content')
@yield('content')
@endsection
8. php artisan make:controller HomeController
9. database > migrations > Delete

10. App > Http > controller > HomeController


public function index($value=' ')
{
return view ('pages.home_content');
}

11. routs > Route::get('/', 'App\Http\Controllers\HomeController@index');


Make Admin Controller And Create Route & View admin_login Page

1. php artisan make:controller AdminController


2. Route::get('/admin', 'App\Http\Controllers\AdminController@index');
3. public function index($value=' ')
{
return view ('admin_login');
}
4. Add CSS, Js & Images Link
5. Change Name & placeholder (45)
---------------------------------------------------------------------------------------------------------------------
Create Route & View admin.dashboard Page

1. admin_layout.blade.php > Past: index.html


2. Route::get('/dashboard', 'App\Http\Controllers\AdminController@show_dashboard');
3. public function show_dashboard($value=' ')
{
return view ('admin.dashboard');
}

4. view > admin > dashboard.blade.php


@extends('admin_layout')
@section('admin_content')
@yield('admin_content')
@endsection
Database: elaravel »Table: tbl_admin

1. Go > Phpmyadmin > Database: elaravel


2. .env and .env.example > DB_DATABASE=elaravel
3. config > database.php > elaravel & root

4. database > migrations ~ Delete


php artisan make:migration create_tbl_admin_table --create=tbl_admin

5. $table->increments('admin_id');
$table->string('admin_email');
$table->string('admin_password');
$table->string('admin_name');
$table->string('admin_phone');
$table->timestamps();
6. php artisan migrate

7. INSERT INTO tbl_admin ( admin_email, admin_password, admin_name, admin_phone) VALUES


('[email protected]', '12345', 'Md Abdul Wadud', '01718590528');

8. Admin_login.blade.php > {{url('/admin-dashboard')}} and {{ csrf_field() }}

9. Route::post('/admin-dashboard', 'App\Http\Controllers\AdminController@dashboard');
Login <p class="alert-danger">
use DB; <?php
use App\Http\Requests; $messege=Session::get('messege');
use Session; if($messege){
use Illuminate\Support\Facades\Redirect; echo $messege;
session_start(); Session::put('messege', null);
}
public function dashboard(Request $request) ?>
{ </p>
$admin_email=$request->admin_email; Logout
$admin_password=md5($request->admin_password);
Admin_layout.blade.php (303) > {{URL::to('/logout')}}
$result=DB::table('tbl_admin')
->where('admin_email', $admin_email)
->where('admin_password', $admin_password)
Route::get('/logout','App\Http\Controllers\SuperAdminController@logout');
->first();
echo "<pre>"; php artisan make:controller SuperAdminController
print_r($result);
exit(); public function logout($value='')
{
if ($result) { // Session::put('admin_name',null);
Session::put('admin_name', $result->admin_name); // Session::put('admin_id',null);
Session:: put('admin_id', $result->admin_id); Session::flush();
return Redirect::to('/dashboard'); return Redirect::to('/admin');
}else{ }
Session::put('messege', 'Email or Password Invalid');
return Redirect::to('/admin'); Admin_layout.blade.php > Show UserName (294) >
} {{ Session::get('admin_name')}}
}
Admin_layout.blade.php > Route::get('/dashboard', 'App\Http\Controllers\SuperAdminController@show_dashboard');

Dashboard > {{URL::to('/dashboard')}} public function show_dashboard($value='')


All Category, { $this->AdminAuthCheck();
Add Category > {{URL::to('/add-category')}} return view ('admin.dashboard');
All Brands, Add Brands }
Products > New > Add Products, All Products
Slider, Social Links, Shop Name, Delivery Man public function AdminAuthCheck()
Service, Quock Shop, Polices, About Shopper {
$admin_id=Session::get('$admin_id');
// Category related rout ------------------------------------- if ($admin_id) {
Route::get('/add-category', 'App\Http\Controllers\CategoryController@index'); return;
php artisan make:controller CategoryController } else {
use DB; return Redirect::to('/admin')->send();
use App\Http\Requests; }
use Session; }
use Illuminate\Support\Facades\Redirect;
session_start();

public function index($value=' ')


{
return view ('admin.add_category');
}

admin > add_category.blade.php


@extends('admin_layout')
@section('admin_content')
Form Elements
@endsection
Add Category
Category Name > name="category_name" Category description > name="category_description"
Category Status > type="checkbox" name="category_status" action="{{url('/save-category')}}" method="post" and {{ csrf_field() }}

1. php artisan make:migration create_tbl_category_table --create=tbl_category

2. Schema::create('tbl_category', function (Blueprint $table) {


$table->increments('category_id');
$table->string('category_name');
$table->string('category_description');
$table->integer('category_status');
$table->timestamps();
});
3. php artisan migrate

4. Database: elaravel »Table: tbl_category > Category_status > default > As defined > 0
2. Route::post('/save-category', 'App\Http\Controllers\CategoryController@save_category');
3. public function save_category(Request $request)
{
$data=array();
$data['category_id']=$request->category_id;
$data['category_name']=$request->category_name;
$data['category_description']=$request->category_description;
$data['category_status']=$request->category_status;

// echo "<pre>";
// print_r($data);
// exit();
DB::table('tbl_category')->insert($data);
Session::put('message', 'Category added successfully');
return Redirect::to('/add-category');
}
4. <p class="alert-success">
<?php
$message=Session::get('message');
if($message){
echo $message;
Session::put('message', null);
}
?>
</p>

CATEGORY
1. Admin_layout.blade.php (325) > {{URL::to('/all-category')}}
2. Route::get('/all-category', 'App\Http\Controllers\CategoryController@all_category');
3. public function all_category($value='')
{
return view ('admin.all_category');
}
4. @extends('admin_layout')
@section('admin_content')
Table.html > Members
@endsection

5. public function all_category($value='')


{
$all_category_info=DB::table('tbl_category')->get();
$manage_category=view ('admin.all_category')
->with('all_category_infos',$all_category_info);
return view ('admin_layout')
->with('admin.all_category',$manage_category);
// return view ('admin.all_category');
}
<table class="table table-striped table-bordered bootstrap-datatable datatable">
<thead>
<tr>
<th>Category ID</th>
<th>Category Name</th>
<th>Category Description</th>
<th>Status</th>
<th>Actions</th>
</tr>
</thead>
@foreach ($all_category_infos as $key => $value)
<tbody>
<tr>
<td>{{$value->category_id}}</td>
<td class="center">{{$value->category_name}}</td>
<td class="center">{{$value->category_description}}</td>

@if($value->category_status==1)
<td class="center">
<span class="label label-success">Active</span>
</td>
@else
<td class="center">
<span class="label label-danger">Inactive</span>
</td>
@endif
<td class="center">
@if($value->category_status==1)
<a class="btn btn-danger" href="{{URL::to('/inactive-category',$value->category_id)}}">
<i class="halflings-icon white thumbs-down"></i>
</a>
@else
<a class="btn btn-success" href="{{URL::to('/active-category',$value->category_id)}}">
<i class="halflings-icon white thumbs-up"></i>
</a>
@endif

<a class="btn btn-info" href="#">


<i class="halflings-icon white edit"></i>
</a>
<a class="btn btn-danger" href="#">
<i class="halflings-icon white trash"></i>
</a>
</td>
</tr>
</tbody>
@endforeach
</table>
Route::get('/inactive-category/{category_id}', 'App\Http\Controllers\CategoryController@inactive_category');
Route::get('/active-category/{category_id}', 'App\Http\Controllers\CategoryController@active_category');

public function inactive_category($category_id)


{
DB::table('tbl_category')
->where('category_id',$category_id)
->update(['category_status'=>0]);
Session::put('message', 'Category Inactive successfully');
return Redirect::to('/all-category');
}

public function active_category($category_id)


{
DB::table('tbl_category')
->where('category_id',$category_id)
->update(['category_status'=>1]);
Session::put('message', 'Category Active successfully');
return Redirect::to('/all-category');
}
<p class="alert-success">
<?php
$message=Session::get('message');
if($message){
echo $message;
Session::put('message', null);
}
?>
</p>
1. all_category.blade.php > {{URL::to('/edit-category',$value->category_id)}}
2. Route::get('/edit-category/{category_id}', 'App\Http\Controllers\CategoryController@edit_category');
3. public function edit_category($category_id)
{
return view('admin.edit_category');
}
4. Edit_category.blade.php > action="{{url('/update-category',$all_category_infos->category_id)}}"
value="{{$all_category_infos->category_name}}"
{{$all_category_infos->category_description}}

5. public function edit_category($category_id)


{
$all_category_info=DB::table('tbl_category')
->where('category_id',$category_id)
->first();
$manage_category=view ('admin.edit_category')
->with('all_category_infos',$all_category_info);
return view ('admin_layout')
->with('admin.edit_category',$manage_category);
// return view('admin.edit_category');
}
7. Route::post('/update-category/{category_id}', 'App\Http\Controllers\CategoryController@update_category');

6. public function update_category(Request $request,$category_id)


{
$data=array();
$data['category_id']=$request->category_id;
$data['category_name']=$request->category_name;
$data['category_description']=$request->category_description;
// print_r($data);
DB::table('tbl_category')
->where('category_id',$category_id)
->update($data);
Session::put('message', 'Category update successfully');
return Redirect::to('/all-category');
}
1. all_category.blade.php > {{URL::to('/delete-category',$value->category_id)}}
2. Route::get('/delete-category/{category_id}', 'App\Http\Controllers\CategoryController@delete_category');
3. public function delete_category($category_id)
{
// print_r($category_id);
DB::table('tbl_category')
->where('category_id',$category_id)
->delete();
Session::put('message', 'Category Delete successfully');
return Redirect::to('/all-category');
}
4. <div class="panel-group category-products" id="accordian">
<?php
$show_all_catagory=DB::table('tbl_category')
->where('category_status',1)
->get();

foreach ($show_all_catagory as $value) { ?>

<div class="panel panel-default">


<div class="panel-heading">
<h4 class="panel-title"><a href="#">{{$value->category_name}}</a></h4>
</div>
</div>
<?php } ?>
</div>
BRANDS
1. php artisan make:migration create_tbl_brands_table --create=tbl_brands

2. Schema::create('tbl_brands', function (Blueprint $table) {


$table->increments('brands_id');
$table->string('brands_name');
$table->string('brands_description');
$table->integer('brands_status');
$table->timestamps();
});
3. php artisan migrate
4. admin_layout.blade.php > href="{{URL::to('/all-brands')}}" and href="{{URL::to('/add-brands')}}"

// brands related rout -------------------------------------


5. Route::get('/add-brands', 'App\Http\Controllers\BrandsController@index');
6. php artisan make:controller BrandsController

7. add_brands.blade.php > action="{{url('/save-brands')}}" and name="brands_name"


8. Route::post('/save-brands', 'App\Http\Controllers\BrandsController@save_brands');
9. public function save_brands(Request $request)
{
$data=array();
$data['brands_id']=$request->brands_id;
$data['brands_name']=$request->brands_name;
$data['brands_description']=$request->brands_description;
$data['brands_status']=$request->brands_status;
// print_r($data);
DB::table('tbl_brands')->insert($data);
Session::put('message', 'Brands added successfully');
return Redirect::to('/add-brands');
}
1. admin_layout.blade.php > href="{{URL::to('/add-brands')}}"
2. Route::get('/all-brands', 'App\Http\Controllers\BrandsController@all_brands');
3. public function all_brands($value='')
{
$all_brands_info=DB::table('tbl_brands')->get();
$manage_brands=view ('admin.all_brands')
->with('all_brands_infos',$all_brands_info);
return view ('admin_layout')
->with('admin.all_brands',$manage_brands);
// return view ('admin.all_brands');
}
4. all_brands.blade.php > Replace all category to brands

5. href="{{URL::to('/inactive-brands',$value->brands_id)}}"
6. Route::get('/inactive-brands/{brands_id}', 'App\Http\Controllers\BrandsController@inactive_brands');
7. public function inactive_brands($brands_id)
{
DB::table('tbl_brands')
->where('brands_id',$brands_id)
->update(['brands_status'=>0]);
Session::put('message', 'brands Inactive successfully');
return Redirect::to('/all-brands');
}
8. href="{{URL::to('/active-brands',$value->brands_id)}}"
9. Route::get('/active-brands/{brands_id}', 'App\Http\Controllers\BrandsController@active_brands');
10. public function active_brands($brands_id)
{
DB::table('tbl_brands')
->where('brands_id',$brands_id)
->update(['brands_status'=>1]);
Session::put('message', 'brands Active successfully');
return Redirect::to('/all-brands');
}
1. href="{{URL::to('/edit-brands',$value->brands_id)}}"
2. Route::get('/edit-brands/{brands_id}', 'App\Http\Controllers\BrandsController@edit_brands');
3. public function edit_brands($brands_id)
{
$all_brands_info=DB::table('tbl_brands')
->where('brands_id',$brands_id)
->first();
$manage_brands=view ('admin.edit_brands')
->with('edit_brands_infos',$all_brands_info);
return view ('admin_layout')
->with('admin.edit_brands',$manage_brands);
// return view('admin.edit_brands');
}
4. edit_brands.blade.php> Replace all category to brands
5. action="{{url('/update-brands',$edit_brands_infos->brands_id)}}"
6. Route::post('/update-brands/{brands_id}', 'App\Http\Controllers\BrandsController@update_brands');
7. public function update_brands(Request $request,$brands_id)
{
$data=array();
$data['brands_id']=$request->brands_id;
$data['brands_name']=$request->brands_name;
$data['brands_description']=$request->brands_description;
// print_r($data);
DB::table('tbl_brands')
->where('brands_id',$brands_id)
->update($data);
Session::put('message', 'brands update successfully');
return Redirect::to('/all-brands');
}
1. href="{{URL::to('/delete-brands',$value->brands_id)}}"
2. Route::get('/delete-brands/{brands_id}', 'App\Http\Controllers\BrandsController@delete_brands');
3. public function delete_brands($brands_id)
{
// print_r($category_id);
DB::table('tbl_brands')
->where('brands_id',$brands_id)
->delete();
Session::put('message', 'brands Delete successfully');
return Redirect::to('/all-brands');
}
4.
<?php
$show_all_brands=DB::table('tbl_brands')
->where('brands_status',1)
->get();

foreach ($show_all_brands as $value){?>

<div class="brands-name">
<ul class="nav nav-pills nav-stacked">
<li><a href="#"> <span
class="pull-right">{{$value->brands_description}}</span>{{$value->brands_name}}</a></li>
</ul>
</div>
<?php } ?>
PRODUCTS
1. php artisan make:migration create_tbl_products_table --create=tbl_products
2. Schema::create('tbl_products', function (Blueprint $table) {
$table->increments('products_id');
$table->string('products_name');
$table->integer('category_id');
$table->integer('brands_id');
$table->longText('products_short_description');
$table->longText('products_long_description');
$table->float('products_price');
$table->string('products_image');
$table->string('products_size');
$table->string('products_color');
$table->integer('products_status');
$table->timestamps();
});
4. php artisan migrate
4. admin_layout.blade.php > href="{{URL::to('/all-products')}}" and href="{{URL::to('/add-products')}}"
5. Route::get('/add-products', 'App\Http\Controllers\ProductsController@index');
6. php artisan make:controller ProductsController
7. public function index($value='')
{
return view('admin.add_products');
}
8. add_products.blade.php
9. add_products.blade.php > Products Name, Products Category, Brands Name, Products Short Description,
Products long Description, Products Price, Products Image, Products Size, Products Color, Products Status
Add_products.blade.php Route::post('/save-products', 'App\Http\Controllers\ProductsController@save_products');
public function save_products(Request $request)
{
@extends('admin_layout')
@section('admin_content')
$data=array();
<div class="row-fluid sortable">
<div class="box span12"> $data['products_name']=$request->products_name;
<div class="box-header" data-original-title>
<h2><i class="halflings-icon edit"></i><span class="break"></span>Add Product</h2>
<div class="box-icon">
$data['category_id']=$request->category_id;
<a href="#" class="btn-setting"><i class="halflings-icon wrench"></i></a>
<a href="#" class="btn-minimize"><i class="halflings-icon chevron-up"></i></a>
<a href="#" class="btn-close"><i class="halflings-icon remove"></i></a>
$data['brands_id']=$request->brands_id;
</div>
</div>
$data['products_short_description']=$request->products_short_description;
<p class="alert-success">
<?php
$data['products_long_description']=$request->products_long_description;
$message=Session::get('message');
if($message){
echo $message;
$data['products_price']=$request->products_price;
Session::put('message', null);
} $data['products_image']=$request->products_image;
?>
</p>
<div class="box-content">
$data['products_size']=$request->products_size;
<form class="form-horizontal" action="{{url('/save-products')}}" method="post" enctype="multipart/form-data">

<fieldset>
{{ csrf_field() }} $data['products_color']=$request->products_color;
<div class="control-group">
<label class="control-label" for="date01">Products Name</label> $data['products_status']=$request->products_status;
<div class="controls">

</div>
<input type="text" class="input-xlarge" id="date01" name="products_name" required> // echo "<pre>";
</div>
<div class="control-group">
<label class="control-label" for="selectError3">Products Category</label>
// print_r($data);
<div class="controls">
<select id="selectError3" name="category_id"> // echo "<pre>";
<option>Select Category</option>

$show_all_catagory=DB::table('tbl_category')
<?php // exit();
->where('category_status',1)
->get();
foreach ($show_all_catagory as $value){?>
$image=$request->file('products_image');
<?php } ?>
<option value="{{$value->category_id}}" required>{{$value->category_name}}</option>
if ($image){
</select>

</div>
</div> // $image_name=str_random(20);
<div class="control-group">
<label class="control-label" for="selectError3">Brands Name</label>
<div class="controls">
$ext=strtolower($image->getClientOriginalName());
<select id="selectError3" name="brands_id">
<option>Select Brands</option> $image_full_name=$ext; //$image_full_name=$image_name.'.'.$ext;
<?php
$show_all_brands=DB::table('tbl_brands')
->where('brands_status',1)
$upload_path='image/';
->get();
foreach ($show_all_brands as $value){?>
<option value="{{$value->brands_id}}" required>{{$value->brands_name}}</option>
$image_url=$upload_path.$image_full_name;
<?php } ?>
</select> $success=$image->move($upload_path,$image_full_name);
</div>
</div>
<div class="control-group hidden-phone">
<label class="control-label" for="textarea2">Products Short Description</label>
<div class="controls">
<textarea class="cleditor" id="textarea2" rows="3" name="products_short_description" required></textarea>
if ($success){
</div>
</div> $data['products_image']=$image_url;
<div class="control-group hidden-phone">
<label class="control-label" for="textarea2">Products long Description</label>
<div class="controls">
DB::table('tbl_products')->insert($data);
</div>
</div>
<textarea class="cleditor" id="textarea2" rows="3" name="products_long_description" required></textarea>
Session::put('message', 'Products added successfully');
<div class="control-group">
<label class="control-label" for="date01">Products Price</label> return Redirect::to('/add-products');
<div class="controls">

</div>
<input type="text" class="input-xlarge" id="date01" name="products_price" required> }
</div>
<div class="control-group">
<label class="control-label">Products Image</label>
}
<div class="controls">
<input type="file" class="input-xlarge" id="date01" name="products_image" required>
</div>
</div>
<div class="control-group">
$data['products_image']='';
<label class="control-label" for="date01">Products Size</label>
<div class="controls">
<input type="text" class="input-xlarge" id="date01" name="products_size" required>
DB::table('tbl_products')->insert($data);
</div>
</div> Session::put('message', 'Products added successfully without image!');
<div class="control-group">
<label class="control-label" for="date01">Products Color</label>
<div class="controls">
return Redirect::to('/add-products');
</div>
</div>
<input type="text" class="input-xlarge" id="date01" name="products_color" required>
}
<div class="control-group">
<label class="control-label" for="date01">Products Status</label>
<div class="controls">
<input type="checkbox" class="input-xlarge" id="date01" value="1" name="products_status" required>
</div>
</div>
<div class="form-actions">

Route::get('/all-products', 'App\Http\Controllers\ProductsController@all_products');
<button type="submit" class="btn btn-primary">Add Products</button>
<button type="reset" class="btn">Cancel</button>
</div>
</fieldset>
</form>

</div><!--/row-->
@endsection
</div><!--/span-->
</div>
public function all_products($value='')
{
$all_products_info=DB::table('tbl_products')
// ->join('tbl_category','tbl_products.category_id','=','tbl_category.category_id')
// ->join('tbl_brands','tbl_products.brands_id','=','tbl_brands.brands_id')
// ->select('tbl_products.*','tbl_category.category_name','tbl_brands.brands_name')
->get();

$manage_products=view ('admin.all_products')
->with('all_products_infos',$all_products_info);
return view ('admin_layout')
->with('admin.all_products',$manage_products);
return view ('admin.all_products');
}
all_products.blade.php ProductsController
@extends('admin_layout')
@section('admin_content')
<div class="row-fluid sortable"> 1. Route::get('/inactive-products/{products_id}', 'App\Http\Controllers\ProductsController@inactive_products');
<div class="box span12">
<div class="box-header" data-original-title>
<h2><i class="halflings-icon user"></i><span class="break"></span>All Products</h2>
<div class="box-icon">
<a href="#" class="btn-setting"><i class="halflings-icon wrench"></i></a>
2. Route::get('/active-products/{products_id}', 'App\Http\Controllers\ProductsController@active_products');
<a href="#" class="btn-minimize"><i class="halflings-icon chevron-up"></i></a>
<a href="#" class="btn-close"><i class="halflings-icon remove"></i></a>
</div>

<p class="alert-success">
</div>
3. public function inactive_products($products_id)
<?php
$message=Session::get('message');
if($message){ {
echo $message;

?>
Session::put('message', null);
} DB::table('tbl_products')
</p>
<div class="box-content">
<table class="table table-striped table-bordered bootstrap-datatable datatable">
->where('products_id',$products_id)
<thead>
<tr>
<th>P ID</th>
->update(['products_status'=>0]);
<th>P Name</th>
<th>category ID</th>
<th>Brands ID</th>
Session::put('message', 'Products Inactive Successfully');
<th>P Short D</th>
<th>P long D</th>
<th>P Price</th> return Redirect::to('/all-products');
<th>P Image</th>
<th>P Size</th>
<th>P Color</th>
<th>Status</th>
}
</thead>
</tr>
<th>Actions</th>
4. public function active_products($products_id)
@foreach ($all_products_infos as $key => $value)
<tbody>
<tr>
{
<td class="center">{{$value->products_id}}</td>
<td class="center">{{$value->products_name}}</td>
<td class="center">{{$value->category_name}}</td>
DB::table('tbl_products')
<td class="center">{{$value->brands_name}}</td>
<td class="center">{{$value->products_short_description}}</td>
<td class="center">{{$value->products_long_description}}</td> ->where('products_id',$products_id)
<td class="center">{{$value->products_price}}</td>
<td><img src="{{URL::to($value->products_image)}}" style="height:80px; width:80px;"></td>
<td class="center">{{$value->products_size}}</td>
<td class="center">{{$value->products_color}}</td>
->update(['products_status'=>1]);
@if($value->products_status==1)
<td class="center">
Session::put('message', 'Products Active Successfully');
@else
</td>
<span class="label label-success">Active</span>
return Redirect::to('/all-products');
<td class="center">

</td>
<span class="label label-danger">Inactive</span>
}
@endif

<td class="center">
@if($value->products_status==1)
<a class="btn btn-danger" href="{{URL::to('/inactive-products',$value->products_id)}}">
<i class="halflings-icon white thumbs-down"></i> 5. Route::get('/delete-products/{products_id}', 'App\Http\Controllers\ProductsController@delete_products');
</a>
@else
<a class="btn btn-success" href="{{URL::to('/active-products',$value->products_id)}}">

@endif
</a>
<i class="halflings-icon white thumbs-up"></i>
6. public function delete_products($products_id)
<a class="btn btn-info" href="{{URL::to('/edit-products',$value->products_id)}}">
<i class="halflings-icon white edit"></i>
{
</a>

<a class="btn btn-danger" href="{{URL::to('/delete-products',$value->products_id)}}"


// print_r($category_id);
id="delete">

</a>
<i class="halflings-icon white trash"></i>
DB::table('tbl_products')
</td>

</tbody>
</tr>
->where('products_id',$products_id)
@endforeach

</div><!--/span-->
</table>
</div> ->delete();
</div><!--/row-->
@endsection Session::put('message', 'Products Delete successfully');
return Redirect::to('/all-products');
}
Edit_products.blade.php ProductsController
@extends('admin_layout')
@section('admin_content')
<div class="row-fluid sortable">
5. Route::get('/edit-products/{products_id}', 'App\Http\Controllers\ProductsController@edit_products');
<div class="box span12">
<div class="box-header" data-original-title>
<h2><i class="halflings-icon edit"></i><span class="break"></span>Add Product</h2>

public function edit_products($products_id)


<div class="box-icon">
<a href="#" class="btn-setting"><i class="halflings-icon wrench"></i></a>
<a href="#" class="btn-minimize"><i class="halflings-icon chevron-up"></i></a>
<a href="#" class="btn-close"><i class="halflings-icon remove"></i></a>
6.
</div>
</div>
{
<p class="alert-success">
<?php
$message=Session::get('message');
$all_products_info=DB::table('tbl_products')
if($message){
echo $message;
Session::put('message', null);
->where('products_id',$products_id)
?>
}
->first();
</p>
<div class="box-content">
<form class="form-horizontal" action="{{url('/update-products',$all_products_infos->products_id)}}" method="post" enctype="multipart/form-data">
$manage_products=view ('admin.edit_products')
<fieldset>
{{ csrf_field() }}

<div class="control-group">
->with('all_products_infos',$all_products_info);
<label class="control-label" for="date01">Products Name</label>
<div class="controls"> return view ('admin_layout')
<input type="text" class="input-xlarge" id="date01" name="products_name" value="{{$all_products_infos->products_name}}" required>
</div>
</div>
->with('admin.edit_products',$manage_products);
<div class="control-group">
<label class="control-label" for="selectError3">Products Category</label>
<div class="controls">
// return view('admin.edit_category');
<select id="selectError3" name="category_id">
<option>Select Category</option> }
<?php
$show_all_catagory=DB::table('tbl_category')
->where('category_status',1)
->get();
foreach ($show_all_catagory as $value){?>
<option value="{{$value->category_id}}" required>{{$value->category_name}}</option>
7. Edit_products.blade.php
<?php } ?>
</select>
</div>
</div>
<div class="control-group">
8. Route::post('/update-products/{products_id}', 'App\Http\Controllers\ProductsController@update_products');
<label class="control-label" for="selectError3">Brands Name</label>
<div class="controls">
<select id="selectError3" name="brands_id">
<option>Select Brands</option>
<?php
$show_all_brands=DB::table('tbl_brands')
->where('brands_status',1)
->get();
9. public function update_products(Request $request,$products_id)
foreach ($show_all_brands as $value){?>

<?php } ?>
<option value="{{$value->brands_id}}" required>{{$value->brands_name}}</option> {
</select>
</div> $data=array();
</div>
<div class="control-group hidden-phone">
<label class="control-label" for="textarea2">Products Short Description</label>
$data['products_name']=$request->products_name;
required>{{$all_products_infos->products_short_description}}</textarea>
<div class="controls">
<textarea class="cleditor" id="textarea2" rows="3" name="products_short_description" $data['category_id']=$request->category_id;
</div>
</div> $data['brands_id']=$request->brands_id;
<div class="control-group hidden-phone">
<label class="control-label" for="textarea2">Products long Description</label>
<div class="controls">
$data['products_short_description']=$request->products_short_description;
</div>
</div>
<textarea class="cleditor" id="textarea2" rows="3" name="products_long_description" required>{{$all_products_infos->products_long_description}}</textarea>
$data['products_long_description']=$request->products_long_description;
<div class="control-group">
<label class="control-label" for="date01">Products Price</label> $data['products_price']=$request->products_price;
<div class="controls">

</div>
<input type="text" class="input-xlarge" id="date01" name="products_price" value="{{$all_products_infos->products_price}}" required> $data['products_image']=$request->products_image;
</div>
<div class="control-group">
<label class="control-label">Products Image</label>
$data['products_size']=$request->products_size;
<div class="controls">
<input type="file" class="input-xlarge" id="date01" value="{{$all_products_infos->products_image}}" $data['products_color']=$request->products_color;
name="products_image" required>

</div>
</div> $data['products_status']=$request->products_status;
<div class="control-group">
<label class="control-label" for="date01">Products Size</label>
<div class="controls">
$image=$request->file('products_image');
</div>
<input type="text" class="input-xlarge" id="date01" name="products_size" value="{{$all_products_infos->products_size}}" required>
if ($image){
</div>
<div class="control-group">
<label class="control-label" for="date01">Products Color</label>
// $image_name=str_random(20);
<div class="controls">

</div>
<input type="text" class="input-xlarge" id="date01" name="products_color" value="{{$all_products_infos->products_color}}" required> $ext=strtolower($image->getClientOriginalName());
</div>
<div class="control-group"> $image_full_name=$ext; //$image_full_name=$image_name.'.'.$ext;
<label class="control-label" for="date01">Products Status</label>
<div class="controls">
<input type="checkbox" class="input-xlarge" id="date01" value="1" name="products_status" required>
$upload_path='image/';
</div>
</div>
<div class="form-actions">
$image_url=$upload_path.$image_full_name;
<button type="submit" class="btn btn-primary">Save Product</button>
<button type="reset" class="btn">Cancel</button> $success=$image->move($upload_path,$image_full_name);
</div>
</fieldset>
</form>

</div><!--/span-->
</div> if ($success){
</div><!--/row-->
@endsection $data['products_image']=$image_url;
DB::table('tbl_products')
->where('products_id',$products_id)
->update($data);
Session::put('message', 'Products added successfully');
return Redirect::to('/all-products');
}
}

$data['products_image']='';
DB::table('tbl_products')
->where('products_id',$products_id)
->update($data);
Session::put('message', 'Products added successfully without image!');
return Redirect::to('/all-products');
}
Show Features Items

HomeController.php home_content.blade.php
public function index($value=' ') <div class="features_items"><!--features_items-->
{ <h2 class="title text-center">Features Items</h2>
$show_features_items=DB::table('tbl_products') <?php foreach ($products_info as $value){?>
->join('tbl_category','tbl_products.category_id','=','tbl_category.category_id') <div class="col-sm-4">
->join('tbl_brands','tbl_products.brands_id','=','tbl_brands.brands_id') <div class="product-image-wrapper">
->select('tbl_products.*','tbl_category.category_name','tbl_brands.brands_name') <div class="single-products">
->where('tbl_products.products_status',1) <div class="productinfo text-center">
->limit(9) <img src="{{URL::to($value->products_image)}}" alt="image" style="height:200px;" />
->get(); <h2>{{$value->products_price}}Tk</h2>
<p>{{$value->products_name}}</p>
$manage_products=view ('pages.home_content') <a href="#" class="btn btn-default add-to-cart"><i class="fa fa-shopping-cart"></i>Add to cart</a>
->with('products_info',$show_features_items); </div>
return view ('layout') <div class="product-overlay">
->with('pages.home_content',$manage_products); <div class="overlay-content">
<h2>{{$value->products_price}}Tk</h2>
// return view ('pages.home_content'); <p>{{$value->products_name}}</p>
} <a href="#" class="btn btn-default add-to-cart"><i class="fa fa-shopping-cart"></i>Add to cart</a>
</div>
</div>
</div>
<div class="choose">
<ul class="nav nav-pills nav-justified">
<li><a href="#"><i class="fa fa-plus-square"></i>Add to wishlist</a></li>
<li><a href="#"><i class="fa fa-plus-square"></i>Add to compare</a></li>
</ul>
</div>
</div>
</div>
<?php } ?>
</div> <!--features_items-->
SLIDER
1. php artisan make:migration create_tbl_slider_table --create=tbl_slider
2 Schema::create('tbl_slider', function (Blueprint $table) { 8. public function edit_slider($slider_id)
$table->increments('slider_id'); {
$table->string('slider_name'); $all_slider_info=DB::table('tbl_slider')
$table->string('slider_tittle'); ->where('slider_id',$slider_id)
->first();
$table->string('slider_description'); $manage_slider=view ('admin.edit_slider')
$table->string('slider_image'); ->with('all_slider_infos',$all_slider_info);
return view ('admin_layout')
$table->integer('slider_status'); ->with('admin.edit_slider',$manage_slider);
$table->timestamps(); return view('admin.edit_slider');
}); }
3. php artisan migrate
4. admin_layout.blade.php > href="{{URL::to('/all-slider')}}" and href="{{URL::to('/add-slider')}}" 9. public function edit_slider($slider_id)
5. php artisan make:controller SliderController {
6. public function index() //copy add_products and past add_slider $all_slider_info=DB::table('tbl_slider')
->where('slider_id',$slider_id)
{ ->first();
return view('admin.add_slider'); $manage_slider=view ('admin.edit_slider')
} ->with('all_slider_infos',$all_slider_info);
return view ('admin_layout')
7. public function save_slider(Request $request) ->with('admin.edit_slider',$manage_slider);
{ // return view('admin.edit_slider');
}
$data['slider_name']=$request->slider_name;
$data['slider_tittle']=$request->slider_tittle; 9. public function update_slider(Request $request,$slider_id)
{
$data['slider_description']=$request->slider_description; $data=array();
$data['slider_status']=$request->slider_status; $data['slider_name']=$request->slider_name;
$image=$request->file('slider_image'); $data['slider_tittle']=$request->slider_tittle;
$data['slider_description']=$request->slider_description;
$data['slider_image']=$request->slider_image;
if ($image){ $data['slider_status']=$request->slider_status;
$image=$request->file('slider_image');
$image_name=Str::random(32);
$ext=strtolower($image->getClientOriginalExtension()); if ($image){
$image_full_name=$image_name.'.'.$ext; $image_name=Str::random(32);
$ext=strtolower($image->getClientOriginalExtension());
$upload_path='slider_images/'; $image_full_name=$image_name.'.'.$ext;
$image_url=$upload_path.$image_full_name; $upload_path='slider_images/';
$success=$image->move($upload_path,$image_full_name); $image_url=$upload_path.$image_full_name;
$success=$image->move($upload_path,$image_full_name);

if ($success){ if ($success){
$data['slider_image']=$image_url;
$data['slider_image']=$image_url; DB::table('tbl_slider')
DB::table('tbl_slider')->insert($data); ->where('slider_id',$slider_id)
Session::put('message', 'slider added successfully'); ->update($data);
Session::put('message', 'slider added successfully');
return Redirect::to('/add-slider'); return Redirect::to('/all-slider');
} }
} }

$data['slider_image']='';
$data['slider_image']=''; DB::table('tbl_slider')
->where('slider_id',$slider_id)
DB::table('tbl_slider')->insert($data); ->update($data);
Session::put('message', 'slider added successfully without image!'); Session::put('message', 'slider added successfully without image!');
return Redirect::to('/add-slider'); return Redirect::to('/all-slider');
}
}
<section id="slider"><!--slider--> <section id="slider "><!--slider-->
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-sm-12"> <div class="col-sm-12">
<div id="slider-carousel" class="carousel slide" data-ride="carousel">
<div id="carousel-example-generic" class="carousel slide " data-ride="carousel">
<ol class="carousel-indicators">
<?php
<li data-target="#slider-carousel" data-slide-to="0" class="active"></li>
$all_published_slider=DB::table('tbl_slider') <li data-target="#slider-carousel" data-slide-to="1"></li>
->where('slider_status',1) <li data-target="#slider-carousel" data-slide-to="2"></li>
->get(); </ol>
?> <div class="carousel-inner">
<!-- Indicators --> <?php
<ol class="carousel-indicators"> $all_published_slider=DB::table('tbl_slider')
@foreach( $all_published_slider as $v_slider ) ->where('slider_status',1)
<li data-target="#carousel-example-generic" data-slide-to="{{ $loop->index }}" class="{{ ->get();
$loop->first ? 'active' : '' }}"></li>
$i=1;
@endforeach
foreach($all_published_slider as $value){
</ol>
if($i==1){?>
<!-- Wrapper for slides --> <div class="item active">
<div class="carousel-inner" role="listbox"> <?php }else{ ?>
@foreach( $all_published_slider as $v_slider ) <div class="item">
<div class="item {{ $loop->first ? ' active' : '' }}" > <?php } ?>
<img class="d-block w-100" src="{{ $v_slider->slider_image }}" style=" width: 100%; <div class="col-sm-3">
height: 280px; "> <h1><span>{{ $value->slider_name }}</span></h1>
<h2>{{ $value->slider_tittle }}</h2>
</div>
<p>{{ $value->slider_description }}</p>
@endforeach
<button type="button" class="btn btn-default get">Get it now</button>
</div> </div>
<!-- Controls --> <div class="col-sm-9">
<a class="left carousel-control" href="#carousel-example-generic" role="button" <img src="{{ $value->slider_image }}" class="girl img-responsive" alt="" style="width:720px;
data-slide="prev"> height:370px;"/>
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span> </div>
<span class="sr-only">Previous</span> </div>
</a> <?php $i++; } ?>
<a class="right carousel-control" href="#carousel-example-generic" role="button" </div>
<a href="#slider-carousel" class="left control-carousel hidden-xs" data-slide="prev">
data-slide="next">
<i class="fa fa-angle-left"></i>
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
</a>
<span class="sr-only">Next</span> <a href="#slider-carousel" class="right control-carousel hidden-xs" data-slide="next">
</a> <i class="fa fa-angle-right"></i>
</div> </a>
</div> </div>
</div> </div>
</div> </div>
</section> <!-- end slide section --> </div>
</section><!--/slider-->
Show Products With Category Show Products With Brands

1. Layout.blade.php > 1. Layout.blade.php >


href="{{URL::to('/category_with_products',$value->category_id)}}" href="{{URL::to('/brands_with_products',$value->brands_id)}}"

2. Route::get('/category_with_products/{category_id}', 2. Route::get('/brands_with_products/{category_id}',
'App\Http\Controllers\HomeController@show_category_with_products'); 'App\Http\Controllers\HomeController@show_brands_with_products');

3. public function show_category_with_products($category_id) 3. public function show_brands_with_products($brands_id)


{ {
$show_category_with_products=DB::table('tbl_products') $show_category_with_brands=DB::table('tbl_products')
->join('tbl_category','tbl_products.category_id','=','tbl_category.category_id') ->join('tbl_category','tbl_products.category_id','=','tbl_category.category_id')
->join('tbl_brands','tbl_products.brands_id','=','tbl_brands.brands_id') ->join('tbl_brands','tbl_products.brands_id','=','tbl_brands.brands_id')
->select('tbl_products.*','tbl_category.category_name','tbl_brands.brands_name') ->select('tbl_products.*','tbl_category.category_name','tbl_brands.brands_name')
->where('tbl_category.category_id',$category_id) ->where('tbl_brands.brands_id',$brands_id)
->where('tbl_products.products_status',1) ->where('tbl_products.products_status',1)
->limit(15) ->limit(15)
->get(); ->get();

$manage_category_with_products=view ('pages.category_with_products') $manage_brands_with_products=view ('pages.brands_with_products')


->with('category_with_products_info',$show_category_with_products); ->with('brands_with_products_info',$show_category_with_brands);
return view ('layout') return view ('layout')
->with('pages.category_with_products',$manage_category_with_products); ->with('pages.brands_with_products',$manage_brands_with_products);
//return view('pages.category_with_products'); //return view('pages.brands_with_products');

// Copy home_content.blade.php and Past category_with_products.blade.php // Copy home_content.blade.php and Past brands_with_products.blade.php
} }
View Products With ID (Products Detail)

1. Home_content.blade.php > href="{{URL::to('/view-products',$value->products_id)}}"


2. Route::get('/view-products/{category_id}', 'App\Http\Controllers\HomeController@view_products_with_id');
3. public function view_products_with_id($products_id)
{
$show_products_with_id=DB::table('tbl_products')
->join('tbl_category','tbl_products.category_id','=','tbl_category.category_id')
->join('tbl_brands','tbl_products.brands_id','=','tbl_brands.brands_id')
->select('tbl_products.*','tbl_category.category_name','tbl_brands.brands_name')
->where('tbl_products.products_id',$products_id)
->where('tbl_products.products_status',1)
->get();

$manage_products_with_id=view ('pages.products_detail')
->with('products_with_detail_info',$show_products_with_id);
return view ('layout')
->with('pages.products_detail',$manage_products_with_id);
//return view('pages.products_detail');

// Copy home_content.blade.php and Past products_detail.blade.php


}
4. <?php foreach ($products_with_detail_info as $value){?>Code<?php } ?>
Add to cart
1. Home_content.blade.php > href="{{URL::to('/view-products',$value->products_id)}}"
2. php artisan make:controller CartController
3. Products_detail.blade.php >
<span>
<span>{{$value->products_price}} Tk</span>
<form action="{{URL('/add-to-cart')}}" method="GET" accept-charset="utf-8">
{{csrf_field()}}
<label>Quantity:</label>
<input type="text" name="qty" value="1"/>
<input type="hidden" name="products_id" value="{{$value->products_id}}">
<button type="submit" class="btn btn-fefault cart">
<i class="fa fa-shopping-cart"></i>
Add to cart
</button>
</form>
</span>
4. public function add_to_cart(Request $request)
{
$qty=$request->qty;
$products_id=$request->products_id;
$products_info=DB::table('tbl_products')
->where('products_id',$products_id)
->first();
// echo "<pre>";
// print_r($products_info);
// echo "</pre>";
}
5. https://github.com/Crinsane/LaravelShoppingcart or https://github.com/darryldecode/laravelshoppingcart
6. composer require gloudemans/shoppingcart
7. Gloudemans\Shoppingcart\ShoppingcartServiceProvider::class,
Customer Checkout and Registration
1. Layout.blade.php > href="{{url('/login-checkout')}}"
2. Route::get('/login-checkout', 'App\Http\Controllers\CheckoutController@login_checkout');
3. public function login_checkout($value='')
{
return view('pages.login');
}

4. php artisan make:migration create_tbl_customer_table --create=tbl_customer

5. Schema::create('tbl_customer', function (Blueprint $table) {


$table->increments('customer_id');
$table->string('customer_name');
$table->string('customer_email');
$table->string('customer_password');
$table->string('customer_phone_number');
$table->timestamps();
});
6. php artisan migrate

1. Login.blade.php > action="{{url('/customer-login')}}" and action="{{url('/customer-registration')}}"

2. Route::post('/customer-registration', 'App\Http\Controllers\CheckoutController@customer_registration');
3. php artisan make:controller CheckoutController
4. public function customer_registration(Request $request)
{
$data=array();
$data['customer_name']=$request->customer_name;
$data['customer_email']=$request->customer_email;
$data['customer_password']=$request->customer_password;
$data['customer_phone_number']=$request->customer_phone_number;

$customer_id=DB::table('tbl_customer')
->insertGetid($data);
session::put('customer_id,$customer_id');
session::put('customer_name,$request->customer_name');
return Redirect::to('/checkout');
}
@extends('layout')
@section('content')
<section id="form"><!--form-->
<div class="container">
<div class="row">
<div class="col-sm-4 col-sm-offset-1">
<div class="login-form"><!--login form-->
<h2>Login to your account</h2>
<form action="{{url('/customer-login')}}" method="post">
{{csrf_field()}}
<input type="email" placeholder="Email Address" name="customer_email" required="" />
<input type="password" placeholder="password" name="customer_password" required="" />
<span>
<input type="checkbox" class="checkbox">
Keep me signed in
</span>
<button type="submit" class="btn btn-default">Login</button>
</form>
</div><!--/login form-->
</div>
<div class="col-sm-1">
<h2 class="or">OR</h2>
</div>
<div class="col-sm-4">
<div class="signup-form"><!--sign up form-->
<h2>New User Signup!</h2>
<form action="{{url('/customer-registration')}}" method="post">
{{csrf_field()}}
<input type="text" placeholder="Full Name" name="customer_name" required="" />
<input type="email" placeholder="Email Address" name="customer_email" required="" />
<input type="password" placeholder="Password" name="customer_password" required="" />
<input type="number" placeholder="Phone Number" name="customer_phone_number" required="" />
<button type="submit" class="btn btn-default">Signup</button>
</form>
</div><!--/sign up form-->
</div>
</div>
</div>
</section><!--/form-->
@endsection
Customer Checkout and Login

1. Route::get('/checkout', 'App\Http\Controllers\CheckoutController@checkout');
2. public function checkout($value='')
{
return view('pages.checkout');
}
3. php artisan make:migration create_tbl_shipping_table --create=tbl_shipping
4. Schema::create('tbl_shipping', function (Blueprint $table) {
$table->increments('shipping_id');
$table->string('shipping_name');
$table->string('shipping_email');
$table->string('shipping_address');
$table->string('shipping_mobile_number');
$table->string('shipping_postal_code');
$table->timestamps();
});

. // public function customer_login(Request $request)


{
$customer_email=$request->customer_email;
$customer_password=md5($request->customer_password);
$result=DB::table('tbl_customer')
->where('customer_email',$customer_email)
->where('customer_password',$customer_password)
->first();
}

You might also like