Project Overview: PHP Frameworks
Project Overview: PHP Frameworks
https://laravel.com/docs/8.x
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/')}}
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
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');
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
@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
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();
<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>
<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>
<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
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');
// 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)
$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');
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();
});