Thứ Ba, 27 tháng 12, 2016

Laravel 5 Tutorial : Laravel 5 CRUD GENERATOR using CRUDBooster Package for Laravel 5.3


Laravel 5.3 Tutorial for beginners - How to create CRUD GENERATOR using CRUDBooster Package for Laravel 5.3? this lessons will show you how to build simple laravel application using CRUD Generator.

At the previews lessons we have create Laravel 5.3 CRUD Operations with example. so please read :
  1. Laravel 5 CRUD with Resource Controller
  2. Laravel 5 CRUD with Vue.Js
  3. Laravel 5 CRUD with Angular Js
  4. Laravel 5 CRUD with Ajax

Video Tutorial Laravel 5 CRUD GENERATOR


What's CRUD Booster?

CRUDBooster is not usual CRUD (read: Create, Read, Update, Delete) Generator Package. CRUDBooster use scafollding system to make sure you only focus at the Controller instead model and view.

All process like assignment, validation, database process are controlled by CRUDBooster instead create them manually.

You can see CRUDBooster on the offical website here http://crudbooster.com/

CRUDBooster System Requirements

  1. PHP >= 5.6.x
  2. Mcrypt PHP Extension
  3. OpenSSL PHP Extension
  4. Mbstring PHP Extension
  5. Tokenizer PHP Extension
  6. FileInfo PHP Extension
  7. Laravel Version 5.3.x
All system requirements must be met, if not, then the system may not run smoothly.

How to Install CRUDBooster?

Follow step by step this tutorial to install CRUDBooster, or you can wacth video above.

Installing Laravel Project

composer create-project --prefer-dist laravel/laravel={version} crudbooster

Install CRUDBooster

composer require crocodicstudio/crudbooster=5.3.0.*

Add the following class provider dependency on config/app.php

...
Barryvdh\DomPDF\ServiceProvider::class,
Maatwebsite\Excel\ExcelServiceProvider::class,
Unisharp\Laravelfilemanager\LaravelFilemanagerServiceProvider::class,
Intervention\Image\ImageServiceProvider::class,
crocodicstudio\crudbooster\CRUDBoosterServiceProvider::class,
...

and the Facedes

...
'PDF' => Barryvdh\DomPDF\Facade::class,
'Excel' => Maatwebsite\Excel\Facades\Excel::class,
'Image' => Intervention\Image\Facades\Image::class,
'CRUDBooster' => crocodicstudio\crudbooster\helpers\CRUDBooster::class,
...

Run the following command in the terminal, this function to publish the configuration file, useful if you will be certain to configure the plugin (Run the following function)

php artisan vendor:publish

and

php artisan vendor:publish --provider="crocodicstudio\crudbooster\CRUDBoosterServiceProvider" --force

Database Setup

Make sure you have created a database on your server, and create connection to our applications, in the .ENV file adding you connection

...
DB_DATABASE= youdatabase
DB_USERNAME= youruser
DB_PASSWORD= yourpassword
...

Migration

Run the following command in order to make major database system CRUDBooster

php artisan migrate --seed

If you've followed the steps above, should CRUDBooster can walk. How to find out is to test into the courtyard Backend.

By default backend CRUDBooster exist at the following URL:

http://localhost:8080/admin
username : admin@crudbooster.com
password : 123456

More Laravel Videos Tutorial





If you found this lessons Helpful, Amazing, and Awesome, please like and share.
See you next lessons .....

Laravel 5 Tutorial : Laravel 5 CRUD GENERATOR using CRUDBooster Package for Laravel 5.3


Laravel 5.3 Tutorial for beginners - How to create CRUD GENERATOR using CRUDBooster Package for Laravel 5.3? this lessons will show you how to build simple laravel application using CRUD Generator.

At the previews lessons we have create Laravel 5.3 CRUD Operations with example. so please read :
  1. Laravel 5 CRUD with Resource Controller
  2. Laravel 5 CRUD with Vue.Js
  3. Laravel 5 CRUD with Angular Js
  4. Laravel 5 CRUD with Ajax

Video Tutorial Laravel 5 CRUD GENERATOR


What's CRUD Booster?

CRUDBooster is not usual CRUD (read: Create, Read, Update, Delete) Generator Package. CRUDBooster use scafollding system to make sure you only focus at the Controller instead model and view.

All process like assignment, validation, database process are controlled by CRUDBooster instead create them manually.

You can see CRUDBooster on the offical website here http://crudbooster.com/

CRUDBooster System Requirements

  1. PHP >= 5.6.x
  2. Mcrypt PHP Extension
  3. OpenSSL PHP Extension
  4. Mbstring PHP Extension
  5. Tokenizer PHP Extension
  6. FileInfo PHP Extension
  7. Laravel Version 5.3.x
All system requirements must be met, if not, then the system may not run smoothly.

How to Install CRUDBooster?

Follow step by step this tutorial to install CRUDBooster, or you can wacth video above.

Installing Laravel Project

composer create-project --prefer-dist laravel/laravel={version} crudbooster

Install CRUDBooster

composer require crocodicstudio/crudbooster=5.3.0.*

Add the following class provider dependency on config/app.php

...
Barryvdh\DomPDF\ServiceProvider::class,
Maatwebsite\Excel\ExcelServiceProvider::class,
Unisharp\Laravelfilemanager\LaravelFilemanagerServiceProvider::class,
Intervention\Image\ImageServiceProvider::class,
crocodicstudio\crudbooster\CRUDBoosterServiceProvider::class,
...

and the Facedes

...
'PDF' => Barryvdh\DomPDF\Facade::class,
'Excel' => Maatwebsite\Excel\Facades\Excel::class,
'Image' => Intervention\Image\Facades\Image::class,
'CRUDBooster' => crocodicstudio\crudbooster\helpers\CRUDBooster::class,
...

Run the following command in the terminal, this function to publish the configuration file, useful if you will be certain to configure the plugin (Run the following function)

php artisan vendor:publish

and

php artisan vendor:publish --provider="crocodicstudio\crudbooster\CRUDBoosterServiceProvider" --force

Database Setup

Make sure you have created a database on your server, and create connection to our applications, in the .ENV file adding you connection

...
DB_DATABASE= youdatabase
DB_USERNAME= youruser
DB_PASSWORD= yourpassword
...

Migration

Run the following command in order to make major database system CRUDBooster

php artisan migrate --seed

If you've followed the steps above, should CRUDBooster can walk. How to find out is to test into the courtyard Backend.

By default backend CRUDBooster exist at the following URL:

http://localhost:8080/admin
username : admin@crudbooster.com
password : 123456

More Laravel Videos Tutorial





If you found this lessons Helpful, Amazing, and Awesome, please like and share.
See you next lessons .....

Laravel 5 Tutorial : Laravel 5 CRUD GENERATOR using CRUDBooster Package for Laravel 5.3


Laravel 5.3 Tutorial for beginners - How to create CRUD GENERATOR using CRUDBooster Package for Laravel 5.3? this lessons will show you how to build simple laravel application using CRUD Generator.

At the previews lessons we have create Laravel 5.3 CRUD Operations with example. so please read :
  1. Laravel 5 CRUD with Resource Controller
  2. Laravel 5 CRUD with Vue.Js
  3. Laravel 5 CRUD with Angular Js
  4. Laravel 5 CRUD with Ajax

Video Tutorial Laravel 5 CRUD GENERATOR


What's CRUD Booster?

CRUDBooster is not usual CRUD (read: Create, Read, Update, Delete) Generator Package. CRUDBooster use scafollding system to make sure you only focus at the Controller instead model and view.

All process like assignment, validation, database process are controlled by CRUDBooster instead create them manually.

You can see CRUDBooster on the offical website here http://crudbooster.com/

CRUDBooster System Requirements

  1. PHP >= 5.6.x
  2. Mcrypt PHP Extension
  3. OpenSSL PHP Extension
  4. Mbstring PHP Extension
  5. Tokenizer PHP Extension
  6. FileInfo PHP Extension
  7. Laravel Version 5.3.x
All system requirements must be met, if not, then the system may not run smoothly.

How to Install CRUDBooster?

Follow step by step this tutorial to install CRUDBooster, or you can wacth video above.

Installing Laravel Project

composer create-project --prefer-dist laravel/laravel={version} crudbooster

Install CRUDBooster

composer require crocodicstudio/crudbooster=5.3.0.*

Add the following class provider dependency on config/app.php

...
Barryvdh\DomPDF\ServiceProvider::class,
Maatwebsite\Excel\ExcelServiceProvider::class,
Unisharp\Laravelfilemanager\LaravelFilemanagerServiceProvider::class,
Intervention\Image\ImageServiceProvider::class,
crocodicstudio\crudbooster\CRUDBoosterServiceProvider::class,
...

and the Facedes

...
'PDF' => Barryvdh\DomPDF\Facade::class,
'Excel' => Maatwebsite\Excel\Facades\Excel::class,
'Image' => Intervention\Image\Facades\Image::class,
'CRUDBooster' => crocodicstudio\crudbooster\helpers\CRUDBooster::class,
...

Run the following command in the terminal, this function to publish the configuration file, useful if you will be certain to configure the plugin (Run the following function)

php artisan vendor:publish

and

php artisan vendor:publish --provider="crocodicstudio\crudbooster\CRUDBoosterServiceProvider" --force

Database Setup

Make sure you have created a database on your server, and create connection to our applications, in the .ENV file adding you connection

...
DB_DATABASE= youdatabase
DB_USERNAME= youruser
DB_PASSWORD= yourpassword
...

Migration

Run the following command in order to make major database system CRUDBooster

php artisan migrate --seed

If you've followed the steps above, should CRUDBooster can walk. How to find out is to test into the courtyard Backend.

By default backend CRUDBooster exist at the following URL:

http://localhost:8080/admin
username : admin@crudbooster.com
password : 123456

More Laravel Videos Tutorial





If you found this lessons Helpful, Amazing, and Awesome, please like and share.
See you next lessons .....

Thứ Hai, 26 tháng 12, 2016

Laravel 5 Tutorial : Image Upload and Resize using Image Intervention with Validation in Laravel 5.3


Laravel 5.3 Tutorial - How to create Image Upload and Resize using Image Intervention with Validation in Laravel 5.3, this lesson will show you how to create simple upload image to public folder before Resize it using Image Intervention. At the previews lessons, we have learn how to create Ajax Image Upload. So please read :

Simple Image upload using Ajax in laravel 5.3

Video Tutorial Simple Upload and Resize Image in laravel 5.3



FULL SOURCE CODE

Here is full source code Image Upload and Resize using Image Intervention Project's

Installation Image Intervention Laravel

System Requirements

Intervention Image requires the following components to work correctly.
PHP >= 5.4
Fileinfo Extension
And one of the following image libraries.
GD Library (>=2.0) … or …
Imagick PHP extension (>=6.5.7)

Install using Composer

composer require intervention/image

After you have installed Intervention Image, open your Laravel config file config/app.php and add the following lines.

In the $providers array add the service providers for this package.

...........
'Intervention\Image\ImageServiceProvider',
...........

Add the facade of this package to the $aliases array.

...........
'Image' => 'Intervention\Image\Facades\Image',
...........

Publish configuration in Laravel 5

php artisan vendor:publish --provider="Intervention\Image\ImageServiceProviderLaravel5"

Controller (ImagesController.php)

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use Image;

class ImagesController extends Controller
{
    public function getImage()
    {
      return view('upload-images');
    }

    public function postImage(Request $request)
    {
      $this->validate($request,[
        'image_file' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:1024',
      ]);
      $image_file = $request->file('image_file');
      $imagename = time().'.'.$image_file->getClientOriginalExtension();
      $destinationPath = public_path('/thumbnail_images');
      $thumb_img = Image::make($image_file->getRealPath())->resize(100, 100);
      $thumb_img->save($destinationPath.'/'.$imagename,80);

      $destinationPath = public_path('/images');
      $image_file->move($destinationPath, $imagename);
      // you can add more function to save image into database,
      // see it on the previews video, links will vaillable on desc
      return back()->with('success','Image Upload successful')->with('imagename',$imagename);
    }
}

Routes (web.php)

Route::get('resizeImage',['as'=>'getimage','uses'=>'ImagesController@getImage']);
Route::post('resizeImage',['as'=>'postimage','uses'=>'ImagesController@postImage']);

Views (upload-images.blade.php)

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Simple images Upload</title>

    <!-- Bootstrap -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.2/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  <body>

    <div class="container">
      <div class="panel panel-primary">
        <div class="panel-heading">
          <h2>Simple Laravel 5.3 Image upload</h2>
        </div>
        <div class="panel-body">
          @if (count($errors) > 0)
            <div class="alert alert-danger">
              @foreach ($errors->all() as $error)
                <p class="error_item">{{ $error }}</p>
              @endforeach
            </div>
          @endif
          @if (Session::get('success'))
            <div class="row">
              <div class="col-md-12">
                <div class="col-md-4">
                  <strong>Image Before Resize:</strong>
                </div>
                <div class="col-md-8">
                  <img src="{{asset('images/'.Session::get('imagename')) }}" />
                </div>
              </div>
              <div class="col-md-12">
                <div class="col-md-4">
                  <strong>Image after Resize:</strong>
                </div>
                <div class="col-md-8">
                  <img src="{{asset('thumbnail_images/'.Session::get('imagename')) }}" />
                </div>
              </div>
            </div>
          @endif
          {!! Form::open(array('route' => 'postimage','files'=>true)) !!}
            <div class="row">
              <div class="col-md-6">
                <br/>
                {!! Form::file('image_file', array('class' => 'form-control')) !!}
              </div>
              <div class="col-md-6">
                <br/>
                <button type="submit" class="btn btn-success">Upload Image</button>
              </div>
            </div>
          {!! Form::close() !!}
        </div>
      </div>
    </div>

    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
  </body>
</html>

More Laravel Video's Tutorial For Beginners :



Download this project from this LINK.

Laravel 5 Tutorial : Image Upload and Resize using Image Intervention with Validation in Laravel 5.3


Laravel 5.3 Tutorial - How to create Image Upload and Resize using Image Intervention with Validation in Laravel 5.3, this lesson will show you how to create simple upload image to public folder before Resize it using Image Intervention. At the previews lessons, we have learn how to create Ajax Image Upload. So please read :

Simple Image upload using Ajax in laravel 5.3

Video Tutorial Simple Upload and Resize Image in laravel 5.3



FULL SOURCE CODE

Here is full source code Image Upload and Resize using Image Intervention Project's

Installation Image Intervention Laravel

System Requirements

Intervention Image requires the following components to work correctly.
PHP >= 5.4
Fileinfo Extension
And one of the following image libraries.
GD Library (>=2.0) … or …
Imagick PHP extension (>=6.5.7)

Install using Composer

composer require intervention/image

After you have installed Intervention Image, open your Laravel config file config/app.php and add the following lines.

In the $providers array add the service providers for this package.

...........
'Intervention\Image\ImageServiceProvider',
...........

Add the facade of this package to the $aliases array.

...........
'Image' => 'Intervention\Image\Facades\Image',
...........

Publish configuration in Laravel 5

php artisan vendor:publish --provider="Intervention\Image\ImageServiceProviderLaravel5"

Controller (ImagesController.php)

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use Image;

class ImagesController extends Controller
{
    public function getImage()
    {
      return view('upload-images');
    }

    public function postImage(Request $request)
    {
      $this->validate($request,[
        'image_file' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:1024',
      ]);
      $image_file = $request->file('image_file');
      $imagename = time().'.'.$image_file->getClientOriginalExtension();
      $destinationPath = public_path('/thumbnail_images');
      $thumb_img = Image::make($image_file->getRealPath())->resize(100, 100);
      $thumb_img->save($destinationPath.'/'.$imagename,80);

      $destinationPath = public_path('/images');
      $image_file->move($destinationPath, $imagename);
      // you can add more function to save image into database,
      // see it on the previews video, links will vaillable on desc
      return back()->with('success','Image Upload successful')->with('imagename',$imagename);
    }
}

Routes (web.php)

Route::get('resizeImage',['as'=>'getimage','uses'=>'ImagesController@getImage']);
Route::post('resizeImage',['as'=>'postimage','uses'=>'ImagesController@postImage']);

Views (upload-images.blade.php)

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Simple images Upload</title>

    <!-- Bootstrap -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.2/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  <body>

    <div class="container">
      <div class="panel panel-primary">
        <div class="panel-heading">
          <h2>Simple Laravel 5.3 Image upload</h2>
        </div>
        <div class="panel-body">
          @if (count($errors) > 0)
            <div class="alert alert-danger">
              @foreach ($errors->all() as $error)
                <p class="error_item">{{ $error }}</p>
              @endforeach
            </div>
          @endif
          @if (Session::get('success'))
            <div class="row">
              <div class="col-md-12">
                <div class="col-md-4">
                  <strong>Image Before Resize:</strong>
                </div>
                <div class="col-md-8">
                  <img src="{{asset('images/'.Session::get('imagename')) }}" />
                </div>
              </div>
              <div class="col-md-12">
                <div class="col-md-4">
                  <strong>Image after Resize:</strong>
                </div>
                <div class="col-md-8">
                  <img src="{{asset('thumbnail_images/'.Session::get('imagename')) }}" />
                </div>
              </div>
            </div>
          @endif
          {!! Form::open(array('route' => 'postimage','files'=>true)) !!}
            <div class="row">
              <div class="col-md-6">
                <br/>
                {!! Form::file('image_file', array('class' => 'form-control')) !!}
              </div>
              <div class="col-md-6">
                <br/>
                <button type="submit" class="btn btn-success">Upload Image</button>
              </div>
            </div>
          {!! Form::close() !!}
        </div>
      </div>
    </div>

    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
  </body>
</html>

More Laravel Video's Tutorial For Beginners :



Download this project from this LINK.

Laravel 5 Tutorial : Image Upload and Resize using Image Intervention with Validation in Laravel 5.3


Laravel 5.3 Tutorial - How to create Image Upload and Resize using Image Intervention with Validation in Laravel 5.3, this lesson will show you how to create simple upload image to public folder before Resize it using Image Intervention. At the previews lessons, we have learn how to create Ajax Image Upload. So please read :

Simple Image upload using Ajax in laravel 5.3

Video Tutorial Simple Upload and Resize Image in laravel 5.3



FULL SOURCE CODE

Here is full source code Image Upload and Resize using Image Intervention Project's

Installation Image Intervention Laravel

System Requirements

Intervention Image requires the following components to work correctly.
PHP >= 5.4
Fileinfo Extension
And one of the following image libraries.
GD Library (>=2.0) … or …
Imagick PHP extension (>=6.5.7)

Install using Composer

composer require intervention/image

After you have installed Intervention Image, open your Laravel config file config/app.php and add the following lines.

In the $providers array add the service providers for this package.

...........
'Intervention\Image\ImageServiceProvider',
...........

Add the facade of this package to the $aliases array.

...........
'Image' => 'Intervention\Image\Facades\Image',
...........

Publish configuration in Laravel 5

php artisan vendor:publish --provider="Intervention\Image\ImageServiceProviderLaravel5"

Controller (ImagesController.php)

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use Image;

class ImagesController extends Controller
{
    public function getImage()
    {
      return view('upload-images');
    }

    public function postImage(Request $request)
    {
      $this->validate($request,[
        'image_file' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:1024',
      ]);
      $image_file = $request->file('image_file');
      $imagename = time().'.'.$image_file->getClientOriginalExtension();
      $destinationPath = public_path('/thumbnail_images');
      $thumb_img = Image::make($image_file->getRealPath())->resize(100, 100);
      $thumb_img->save($destinationPath.'/'.$imagename,80);

      $destinationPath = public_path('/images');
      $image_file->move($destinationPath, $imagename);
      // you can add more function to save image into database,
      // see it on the previews video, links will vaillable on desc
      return back()->with('success','Image Upload successful')->with('imagename',$imagename);
    }
}

Routes (web.php)

Route::get('resizeImage',['as'=>'getimage','uses'=>'ImagesController@getImage']);
Route::post('resizeImage',['as'=>'postimage','uses'=>'ImagesController@postImage']);

Views (upload-images.blade.php)

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Simple images Upload</title>

    <!-- Bootstrap -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.2/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  <body>

    <div class="container">
      <div class="panel panel-primary">
        <div class="panel-heading">
          <h2>Simple Laravel 5.3 Image upload</h2>
        </div>
        <div class="panel-body">
          @if (count($errors) > 0)
            <div class="alert alert-danger">
              @foreach ($errors->all() as $error)
                <p class="error_item">{{ $error }}</p>
              @endforeach
            </div>
          @endif
          @if (Session::get('success'))
            <div class="row">
              <div class="col-md-12">
                <div class="col-md-4">
                  <strong>Image Before Resize:</strong>
                </div>
                <div class="col-md-8">
                  <img src="{{asset('images/'.Session::get('imagename')) }}" />
                </div>
              </div>
              <div class="col-md-12">
                <div class="col-md-4">
                  <strong>Image after Resize:</strong>
                </div>
                <div class="col-md-8">
                  <img src="{{asset('thumbnail_images/'.Session::get('imagename')) }}" />
                </div>
              </div>
            </div>
          @endif
          {!! Form::open(array('route' => 'postimage','files'=>true)) !!}
            <div class="row">
              <div class="col-md-6">
                <br/>
                {!! Form::file('image_file', array('class' => 'form-control')) !!}
              </div>
              <div class="col-md-6">
                <br/>
                <button type="submit" class="btn btn-success">Upload Image</button>
              </div>
            </div>
          {!! Form::close() !!}
        </div>
      </div>
    </div>

    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
  </body>
</html>

More Laravel Video's Tutorial For Beginners :



Download this project from this LINK.

Thứ Hai, 19 tháng 12, 2016

Laravel 5 Tutorial : How to Export to PDF using Dompdf Library with Example


Laravel 5.3 Tutorial For Beginners : This lessons will show you how to Export to PDF using Dompdf Library with Example in laravel 5.3. At the previews lessons we have learn how to create multiple upload form in laravel 5.3, so please read :

Laravel 5.3 Multiple File Upload & Save Into Database

Video Tutorial How to Export to PDF using Dompdf Library with Example



Full source code

Controller (PDFController.php)

<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use PDF;
use App\datatoPDF;
class PDFController extends Controller
{
    // show all data
    public function index(Request $req)
    {
      // show all data to index
      $blogs = datatoPDF::all();
      view()->share('blogs',$blogs);
      if($req->has('download')){
        $pdf = PDF::loadView('pdf')->setPaper('a4', 'landscape');
        return $pdf->download('pdf');
      }
      return view('index');
    }
}

Model (datatoPDF.php)

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class datatoPDF extends Model
{
    protected $table = 'users';
}

View (index.blade.php)

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>All Users Data</title>

    <!-- Bootstrap -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.2/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  <body>

    <div class="container">
      <h2>All Users Data</h2>
      <div class="btn-group">
        <button class="btn btn-primary btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
          Export All Data <span class="caret"></span>
        </button>
        <ul class="dropdown-menu">
          <li><a href="{{ route('htmltopdf',['download'=>'pdf']) }}">Export to PDF</a></li>
        </ul>
      </div>
      <table class="table table-striped">
        <thead>
          <tr>
            <th>ID</th>
            <th>Name</th>
            <th>Email</th>
            <th>Password</th>
            <th>Created At</th>
            <th><button class="btn btn-success btn-xs">Add New Supplier</button></th>
          </tr>
        </thead>
        <tbody>
          @foreach($blogs as $blog)
            <tr>
              <td>{{ $blog->id }}</td>
              <td>{{ $blog->name }}</td>
              <td>{{ $blog->email }}</td>
              <td>{{ $blog->password }}</td>
              <td>{{ $blog->created_at }}</td>
              <td>
                <button class="btn btn-warning btn-xs btn-detail">
                  <span class="glyphicon glyphicon-edit"></span>
                </button>
                <button class="btn btn-danger btn-xs btn-delete">
                  <span class="glyphicon glyphicon-trash"></span>
                </button>
              </td>
            </tr>
          @endforeach
        </tbody>
      </table>
    </div>
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
  </body>
</html>

pdf.blade.php

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>All User data To PDF</title>
  </head>
  <body>
    <div class="container">
      <h2>All Users Data PDF</h2>
      <table class="table table-striped">
        <thead>
          <tr>
            <th>ID</th>
            <th>Name</th>
            <th>Email</th>
            <th>Password</th>
            <th>Created At</th>
          </tr>
        </thead>
        <tbody>
          @foreach($blogs as $blog)
            <tr>
              <td>{{ $blog->id }}</td>
              <td>{{ $blog->name }}</td>
              <td>{{ $blog->email }}</td>
              <td>{{ $blog->password }}</td>
              <td>{{ $blog->created_at }}</td>
            </tr>
          @endforeach
        </tbody>
      </table>
    </div>
  </body>
</html>

Download Full Source Code here.

See you next lessons ...

Laravel 5 Tutorial : How to Export to PDF using Dompdf Library with Example


Laravel 5.3 Tutorial For Beginners : This lessons will show you how to Export to PDF using Dompdf Library with Example in laravel 5.3. At the previews lessons we have learn how to create multiple upload form in laravel 5.3, so please read :

Laravel 5.3 Multiple File Upload & Save Into Database

Video Tutorial How to Export to PDF using Dompdf Library with Example



Full source code

Controller (PDFController.php)

<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use PDF;
use App\datatoPDF;
class PDFController extends Controller
{
    // show all data
    public function index(Request $req)
    {
      // show all data to index
      $blogs = datatoPDF::all();
      view()->share('blogs',$blogs);
      if($req->has('download')){
        $pdf = PDF::loadView('pdf')->setPaper('a4', 'landscape');
        return $pdf->download('pdf');
      }
      return view('index');
    }
}

Model (datatoPDF.php)

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class datatoPDF extends Model
{
    protected $table = 'users';
}

View (index.blade.php)

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>All Users Data</title>

    <!-- Bootstrap -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.2/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  <body>

    <div class="container">
      <h2>All Users Data</h2>
      <div class="btn-group">
        <button class="btn btn-primary btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
          Export All Data <span class="caret"></span>
        </button>
        <ul class="dropdown-menu">
          <li><a href="{{ route('htmltopdf',['download'=>'pdf']) }}">Export to PDF</a></li>
        </ul>
      </div>
      <table class="table table-striped">
        <thead>
          <tr>
            <th>ID</th>
            <th>Name</th>
            <th>Email</th>
            <th>Password</th>
            <th>Created At</th>
            <th><button class="btn btn-success btn-xs">Add New Supplier</button></th>
          </tr>
        </thead>
        <tbody>
          @foreach($blogs as $blog)
            <tr>
              <td>{{ $blog->id }}</td>
              <td>{{ $blog->name }}</td>
              <td>{{ $blog->email }}</td>
              <td>{{ $blog->password }}</td>
              <td>{{ $blog->created_at }}</td>
              <td>
                <button class="btn btn-warning btn-xs btn-detail">
                  <span class="glyphicon glyphicon-edit"></span>
                </button>
                <button class="btn btn-danger btn-xs btn-delete">
                  <span class="glyphicon glyphicon-trash"></span>
                </button>
              </td>
            </tr>
          @endforeach
        </tbody>
      </table>
    </div>
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
  </body>
</html>

pdf.blade.php

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>All User data To PDF</title>
  </head>
  <body>
    <div class="container">
      <h2>All Users Data PDF</h2>
      <table class="table table-striped">
        <thead>
          <tr>
            <th>ID</th>
            <th>Name</th>
            <th>Email</th>
            <th>Password</th>
            <th>Created At</th>
          </tr>
        </thead>
        <tbody>
          @foreach($blogs as $blog)
            <tr>
              <td>{{ $blog->id }}</td>
              <td>{{ $blog->name }}</td>
              <td>{{ $blog->email }}</td>
              <td>{{ $blog->password }}</td>
              <td>{{ $blog->created_at }}</td>
            </tr>
          @endforeach
        </tbody>
      </table>
    </div>
  </body>
</html>

Download Full Source Code here.

See you next lessons ...

Laravel 5 Tutorial : How to Export to PDF using Dompdf Library with Example


Laravel 5.3 Tutorial For Beginners : This lessons will show you how to Export to PDF using Dompdf Library with Example in laravel 5.3. At the previews lessons we have learn how to create multiple upload form in laravel 5.3, so please read :

Laravel 5.3 Multiple File Upload & Save Into Database

Video Tutorial How to Export to PDF using Dompdf Library with Example



Full source code

Controller (PDFController.php)

<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use PDF;
use App\datatoPDF;
class PDFController extends Controller
{
    // show all data
    public function index(Request $req)
    {
      // show all data to index
      $blogs = datatoPDF::all();
      view()->share('blogs',$blogs);
      if($req->has('download')){
        $pdf = PDF::loadView('pdf')->setPaper('a4', 'landscape');
        return $pdf->download('pdf');
      }
      return view('index');
    }
}

Model (datatoPDF.php)

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class datatoPDF extends Model
{
    protected $table = 'users';
}

View (index.blade.php)

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>All Users Data</title>

    <!-- Bootstrap -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.2/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  <body>

    <div class="container">
      <h2>All Users Data</h2>
      <div class="btn-group">
        <button class="btn btn-primary btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
          Export All Data <span class="caret"></span>
        </button>
        <ul class="dropdown-menu">
          <li><a href="{{ route('htmltopdf',['download'=>'pdf']) }}">Export to PDF</a></li>
        </ul>
      </div>
      <table class="table table-striped">
        <thead>
          <tr>
            <th>ID</th>
            <th>Name</th>
            <th>Email</th>
            <th>Password</th>
            <th>Created At</th>
            <th><button class="btn btn-success btn-xs">Add New Supplier</button></th>
          </tr>
        </thead>
        <tbody>
          @foreach($blogs as $blog)
            <tr>
              <td>{{ $blog->id }}</td>
              <td>{{ $blog->name }}</td>
              <td>{{ $blog->email }}</td>
              <td>{{ $blog->password }}</td>
              <td>{{ $blog->created_at }}</td>
              <td>
                <button class="btn btn-warning btn-xs btn-detail">
                  <span class="glyphicon glyphicon-edit"></span>
                </button>
                <button class="btn btn-danger btn-xs btn-delete">
                  <span class="glyphicon glyphicon-trash"></span>
                </button>
              </td>
            </tr>
          @endforeach
        </tbody>
      </table>
    </div>
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
  </body>
</html>

pdf.blade.php

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>All User data To PDF</title>
  </head>
  <body>
    <div class="container">
      <h2>All Users Data PDF</h2>
      <table class="table table-striped">
        <thead>
          <tr>
            <th>ID</th>
            <th>Name</th>
            <th>Email</th>
            <th>Password</th>
            <th>Created At</th>
          </tr>
        </thead>
        <tbody>
          @foreach($blogs as $blog)
            <tr>
              <td>{{ $blog->id }}</td>
              <td>{{ $blog->name }}</td>
              <td>{{ $blog->email }}</td>
              <td>{{ $blog->password }}</td>
              <td>{{ $blog->created_at }}</td>
            </tr>
          @endforeach
        </tbody>
      </table>
    </div>
  </body>
</html>

Download Full Source Code here.

See you next lessons ...

Thứ Bảy, 17 tháng 12, 2016

laravel 5 Tutorial : Laravel 5.3 Multiple File Upload & Save Into Database


Laravel 5.3 Tutorial for beginners : How to create simple Laravel 5.3 Multiple File Upload & Save Into Database, this lessons will show you how to create Upload Form in Laravel 5.3 with multiple file upload and will save into database.

at the previews lessons we have create simple upload images in laravel 5.3 using Ajax, so please read :

Upload Images in Laravel 5.3

Video Tutorial Laravel 5.3 Multiple File Upload


Full Source Code

Migrate

    public function up() {
        // create upload table
        Schema::create('upload', function(Blueprint $table) {
        $table->increments('id');
        $table->string('filename');
        $table->string('mime');
        $table->string('original_filename');
        $table->timestamps();
      });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down() {
        // drop upload table
        Schema::drop('upload');
    }

Model (Uploads.php)

<?php
namespace App;
use Illuminate\Database\Eloquent\Model;

class Uploads extends Model {
    // upload model
    protected $table = 'upload';
}

Controller (UploadsController.php)

<?php

namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Input;
use Validator;
use Response;
use Redirect;
use Session;
use App\Uploads;

class UploadsController extends Controller {
    public function index() {
      return view('upload.index');
    }
    public function multiple_upload() {
      // getting all of the post data
      $files = Input::file('images');
      // Making counting of uploaded images
      $file_count = count($files);
      // start count how many uploaded
      $uploadcount = 0;

      foreach ($files as $file) {
        $rules = array('file' => 'required'); //'required|mimes:png,gif,jpeg,txt,pdf,doc'
        $validator = Validator::make(array('file'=> $file), $rules);
        if($validator->passes()){
          $destinationPath = 'uploads'; // upload folder in public directory
          $filename = $file->getClientOriginalName();
          $upload_success = $file->move($destinationPath, $filename);
          $uploadcount ++;

          // save into database
          $extension = $file->getClientOriginalExtension();
          $entry = new Uploads();
          $entry->mime = $file->getClientMimeType();
          $entry->original_filename = $filename;
          $entry->filename = $file->getFilename().'.'.$extension;
          $entry->save();
        }
      }
      if($uploadcount == $file_count){
        Session::flash('success', 'Upload successfully');
        return Redirect::to('upload');
      } else {
        return Redirect::to('upload')->withInput()->withErrors($validator);
      }
    }
}

Routes (Web.php)

Route::get('upload', 'UploadsController@index');
Route::post('upload/uploadFiles', 'UploadsController@multiple_upload');

View (upload\index.blade.php)

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Multiple Upload</title>

    <!-- Bootstrap -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.2/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  <body>

    <div class="container">
      @if(Session::has('success'))
        <div class="alert-box success">
          <h2>{!! Session::get('success') !!}</h2>
        </div>
      @endif
      <div class="form-group">
        <h2>Simple Multiple Upload</h2>
        {!! Form::open(array('url'=>'upload/uploadFiles','method'=>'POST', 'files'=>true)) !!}
        {!! Form::file('images[]', array('multiple'=>true)) !!}
          <p>{!!$errors->first('images')!!}</p>
          @if(Session::has('error'))
            <p>{!! Session::get('error') !!}</p>
          @endif
        {!! Form::submit('Submit', array('class'=>'btn btn-lg btn-primary col-md-4')) !!}
        {!! Form::close() !!}
      </div>
    </div>
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
  </body>
</html>

Download Full source code here
see you next lessons ...

laravel 5 Tutorial : Laravel 5.3 Multiple File Upload & Save Into Database


Laravel 5.3 Tutorial for beginners : How to create simple Laravel 5.3 Multiple File Upload & Save Into Database, this lessons will show you how to create Upload Form in Laravel 5.3 with multiple file upload and will save into database.

at the previews lessons we have create simple upload images in laravel 5.3 using Ajax, so please read :

Upload Images in Laravel 5.3

Video Tutorial Laravel 5.3 Multiple File Upload


Full Source Code

Migrate

    public function up() {
        // create upload table
        Schema::create('upload', function(Blueprint $table) {
        $table->increments('id');
        $table->string('filename');
        $table->string('mime');
        $table->string('original_filename');
        $table->timestamps();
      });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down() {
        // drop upload table
        Schema::drop('upload');
    }

Model (Uploads.php)

<?php
namespace App;
use Illuminate\Database\Eloquent\Model;

class Uploads extends Model {
    // upload model
    protected $table = 'upload';
}

Controller (UploadsController.php)

<?php

namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Input;
use Validator;
use Response;
use Redirect;
use Session;
use App\Uploads;

class UploadsController extends Controller {
    public function index() {
      return view('upload.index');
    }
    public function multiple_upload() {
      // getting all of the post data
      $files = Input::file('images');
      // Making counting of uploaded images
      $file_count = count($files);
      // start count how many uploaded
      $uploadcount = 0;

      foreach ($files as $file) {
        $rules = array('file' => 'required'); //'required|mimes:png,gif,jpeg,txt,pdf,doc'
        $validator = Validator::make(array('file'=> $file), $rules);
        if($validator->passes()){
          $destinationPath = 'uploads'; // upload folder in public directory
          $filename = $file->getClientOriginalName();
          $upload_success = $file->move($destinationPath, $filename);
          $uploadcount ++;

          // save into database
          $extension = $file->getClientOriginalExtension();
          $entry = new Uploads();
          $entry->mime = $file->getClientMimeType();
          $entry->original_filename = $filename;
          $entry->filename = $file->getFilename().'.'.$extension;
          $entry->save();
        }
      }
      if($uploadcount == $file_count){
        Session::flash('success', 'Upload successfully');
        return Redirect::to('upload');
      } else {
        return Redirect::to('upload')->withInput()->withErrors($validator);
      }
    }
}

Routes (Web.php)

Route::get('upload', 'UploadsController@index');
Route::post('upload/uploadFiles', 'UploadsController@multiple_upload');

View (upload\index.blade.php)

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Multiple Upload</title>

    <!-- Bootstrap -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.2/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  <body>

    <div class="container">
      @if(Session::has('success'))
        <div class="alert-box success">
          <h2>{!! Session::get('success') !!}</h2>
        </div>
      @endif
      <div class="form-group">
        <h2>Simple Multiple Upload</h2>
        {!! Form::open(array('url'=>'upload/uploadFiles','method'=>'POST', 'files'=>true)) !!}
        {!! Form::file('images[]', array('multiple'=>true)) !!}
          <p>{!!$errors->first('images')!!}</p>
          @if(Session::has('error'))
            <p>{!! Session::get('error') !!}</p>
          @endif
        {!! Form::submit('Submit', array('class'=>'btn btn-lg btn-primary col-md-4')) !!}
        {!! Form::close() !!}
      </div>
    </div>
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
  </body>
</html>

Download Full source code here
see you next lessons ...

laravel 5 Tutorial : Laravel 5.3 Multiple File Upload & Save Into Database


Laravel 5.3 Tutorial for beginners : How to create simple Laravel 5.3 Multiple File Upload & Save Into Database, this lessons will show you how to create Upload Form in Laravel 5.3 with multiple file upload and will save into database.

at the previews lessons we have create simple upload images in laravel 5.3 using Ajax, so please read :

Upload Images in Laravel 5.3

Video Tutorial Laravel 5.3 Multiple File Upload


Full Source Code

Migrate

    public function up() {
        // create upload table
        Schema::create('upload', function(Blueprint $table) {
        $table->increments('id');
        $table->string('filename');
        $table->string('mime');
        $table->string('original_filename');
        $table->timestamps();
      });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down() {
        // drop upload table
        Schema::drop('upload');
    }

Model (Uploads.php)

<?php
namespace App;
use Illuminate\Database\Eloquent\Model;

class Uploads extends Model {
    // upload model
    protected $table = 'upload';
}

Controller (UploadsController.php)

<?php

namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Input;
use Validator;
use Response;
use Redirect;
use Session;
use App\Uploads;

class UploadsController extends Controller {
    public function index() {
      return view('upload.index');
    }
    public function multiple_upload() {
      // getting all of the post data
      $files = Input::file('images');
      // Making counting of uploaded images
      $file_count = count($files);
      // start count how many uploaded
      $uploadcount = 0;

      foreach ($files as $file) {
        $rules = array('file' => 'required'); //'required|mimes:png,gif,jpeg,txt,pdf,doc'
        $validator = Validator::make(array('file'=> $file), $rules);
        if($validator->passes()){
          $destinationPath = 'uploads'; // upload folder in public directory
          $filename = $file->getClientOriginalName();
          $upload_success = $file->move($destinationPath, $filename);
          $uploadcount ++;

          // save into database
          $extension = $file->getClientOriginalExtension();
          $entry = new Uploads();
          $entry->mime = $file->getClientMimeType();
          $entry->original_filename = $filename;
          $entry->filename = $file->getFilename().'.'.$extension;
          $entry->save();
        }
      }
      if($uploadcount == $file_count){
        Session::flash('success', 'Upload successfully');
        return Redirect::to('upload');
      } else {
        return Redirect::to('upload')->withInput()->withErrors($validator);
      }
    }
}

Routes (Web.php)

Route::get('upload', 'UploadsController@index');
Route::post('upload/uploadFiles', 'UploadsController@multiple_upload');

View (upload\index.blade.php)

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Multiple Upload</title>

    <!-- Bootstrap -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.2/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  <body>

    <div class="container">
      @if(Session::has('success'))
        <div class="alert-box success">
          <h2>{!! Session::get('success') !!}</h2>
        </div>
      @endif
      <div class="form-group">
        <h2>Simple Multiple Upload</h2>
        {!! Form::open(array('url'=>'upload/uploadFiles','method'=>'POST', 'files'=>true)) !!}
        {!! Form::file('images[]', array('multiple'=>true)) !!}
          <p>{!!$errors->first('images')!!}</p>
          @if(Session::has('error'))
            <p>{!! Session::get('error') !!}</p>
          @endif
        {!! Form::submit('Submit', array('class'=>'btn btn-lg btn-primary col-md-4')) !!}
        {!! Form::close() !!}
      </div>
    </div>
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
  </body>
</html>

Download Full source code here
see you next lessons ...

Lumen API Tutorial : Lumen 5.3 HTTP Routing Methods with Laravel 5.3 Components


Lumen API Tutorial for beginners : this lessons will show you How to use Lumen 5.3 HTTP Routing Methods with Laravel 5.3 Components, at the previews lessons, we have learn about installing Lumen 5.3 using composer, so please read :

How to Install Lumen 5.3 using Composer

Video Tutorial Lumen 5.3 HTTP Routing Methods



Basic Routing

You will define all of the routes for your application in the routes/web.php file. The most basic Lumen routes simply accept a URI and a Closure:

$app->get('foo', function () {
    return 'Hello World';
});

$app->post('foo', function () {
    //
});

Available Router Methods

The router allows you to register routes that respond to any HTTP verb :
$app->get($uri, $callback);
$app->post($uri, $callback);
$app->put($uri, $callback);
$app->patch($uri, $callback);
$app->delete($uri, $callback);
$app->options($uri, $callback);

Route Parameters

Required Parameters

Of course, sometimes you will need to capture segments of the URI within your route. For example, you may need to capture a user's ID from the URL. You may do so by defining route parameters:

$app->get('user/{id}', function ($id) {
    return 'User '.$id;
});

You may define as many route parameters as required by your route:

$app->get('posts/{post}/comments/{comment}', function ($postId, $commentId) {
    //
});

Route Groups

Route groups allow you to share route attributes, such as middleware or namespaces, across a large number of routes without needing to define those attributes on each individual route. Shared attributes are specified in an array format as the first parameter to the $app->group method.

To learn more about route groups, we'll walk through several common use-cases for the feature.

Middleware

To assign middleware to all routes within a group, you may use the middleware key in the group attribute array. Middleware will be executed in the order you define this array:

$app->group(['middleware' => 'auth'], function () use ($app) {
    $app->get('/', function ()    {
        // Uses Auth Middleware
    });

    $app->get('user/profile', function () {
        // Uses Auth Middleware
    });
});

For more detail about Routing in Lumen 5.3 go to Lumen documents https://lumen.laravel.com/docs/5.3/routing

More Lumen 5.3 Video's Tutorial



See you next lessons ....

Lumen API Tutorial : Lumen 5.3 HTTP Routing Methods with Laravel 5.3 Components


Lumen API Tutorial for beginners : this lessons will show you How to use Lumen 5.3 HTTP Routing Methods with Laravel 5.3 Components, at the previews lessons, we have learn about installing Lumen 5.3 using composer, so please read :

How to Install Lumen 5.3 using Composer

Video Tutorial Lumen 5.3 HTTP Routing Methods



Basic Routing

You will define all of the routes for your application in the routes/web.php file. The most basic Lumen routes simply accept a URI and a Closure:

$app->get('foo', function () {
    return 'Hello World';
});

$app->post('foo', function () {
    //
});

Available Router Methods

The router allows you to register routes that respond to any HTTP verb :
$app->get($uri, $callback);
$app->post($uri, $callback);
$app->put($uri, $callback);
$app->patch($uri, $callback);
$app->delete($uri, $callback);
$app->options($uri, $callback);

Route Parameters

Required Parameters

Of course, sometimes you will need to capture segments of the URI within your route. For example, you may need to capture a user's ID from the URL. You may do so by defining route parameters:

$app->get('user/{id}', function ($id) {
    return 'User '.$id;
});

You may define as many route parameters as required by your route:

$app->get('posts/{post}/comments/{comment}', function ($postId, $commentId) {
    //
});

Route Groups

Route groups allow you to share route attributes, such as middleware or namespaces, across a large number of routes without needing to define those attributes on each individual route. Shared attributes are specified in an array format as the first parameter to the $app->group method.

To learn more about route groups, we'll walk through several common use-cases for the feature.

Middleware

To assign middleware to all routes within a group, you may use the middleware key in the group attribute array. Middleware will be executed in the order you define this array:

$app->group(['middleware' => 'auth'], function () use ($app) {
    $app->get('/', function ()    {
        // Uses Auth Middleware
    });

    $app->get('user/profile', function () {
        // Uses Auth Middleware
    });
});

For more detail about Routing in Lumen 5.3 go to Lumen documents https://lumen.laravel.com/docs/5.3/routing

More Lumen 5.3 Video's Tutorial



See you next lessons ....

Thứ Sáu, 16 tháng 12, 2016

Lumen API Tutorial : How to Installing Lumen 5.3 Laravel 5.3 Components Using Composer


Lumen 5.3 API Tutorial for beginners - This lesson will show you how to install Lumen 5.3 with Laravel 5.3 Components using composer in windows, at the previews lessons we have learn about install Laravel 5.3 using composer, please read :

Install Laravel 5.4 using Composer

Video Tutorial How to Install Lumen 5.3



The Lumen framework has a few system requirements. Of course, all of these requirements are satisfied by the Laravel Homestead virtual machine, so it's highly recommended that you use Homestead as your local Lumen development environment.

However, if you are not using Homestead, you will need to make sure your server meets the following requirements:
  1. PHP >= 5.6.4
  2. OpenSSL PHP Extension
  3. PDO PHP Extension
  4. Mbstring PHP Extension
More detail go to Lumen Doc

Configuration

All of the configuration options for the Lumen framework are stored in the .env file. Once Lumen is installed, you should also configure your local environment.

Application Key

The next thing you should do after installing Lumen is set your application key to a random string. Typically, this string should be 32 characters long. The key can be set in the .env environment file. If you have not renamed the .env.example file to .env, you should do that now. If the application key is not set, your user encrypted data will not be secure!

More Lumen Video's



See you next lessons ...

Lumen API Tutorial : How to Installing Lumen 5.3 Laravel 5.3 Components Using Composer


Lumen 5.3 API Tutorial for beginners - This lesson will show you how to install Lumen 5.3 with Laravel 5.3 Components using composer in windows, at the previews lessons we have learn about install Laravel 5.3 using composer, please read :

Install Laravel 5.4 using Composer

Video Tutorial How to Install Lumen 5.3



The Lumen framework has a few system requirements. Of course, all of these requirements are satisfied by the Laravel Homestead virtual machine, so it's highly recommended that you use Homestead as your local Lumen development environment.

However, if you are not using Homestead, you will need to make sure your server meets the following requirements:
  1. PHP >= 5.6.4
  2. OpenSSL PHP Extension
  3. PDO PHP Extension
  4. Mbstring PHP Extension
More detail go to Lumen Doc

Configuration

All of the configuration options for the Lumen framework are stored in the .env file. Once Lumen is installed, you should also configure your local environment.

Application Key

The next thing you should do after installing Lumen is set your application key to a random string. Typically, this string should be 32 characters long. The key can be set in the .env environment file. If you have not renamed the .env.example file to .env, you should do that now. If the application key is not set, your user encrypted data will not be secure!

More Lumen Video's



See you next lessons ...

Thứ Tư, 14 tháng 12, 2016

Laravel 5 Forum Tutorial : Simple Laravel 5.3 Forum Package with Chatter Plugin


Laravel 5.3 Forum Package Tutorial - How to build simple forum in Laravel 5.3 with "Chatter Package", This lessons will show you how to step by step create Forum Apps in Laravel project. At the previews lessons we have learn about build Laravel Admin panel using "Voyager" Package. Please Read :

Laravel Dashboard Package Example with Voyager.

Video Tutorial Simple Laravel 5.3 Forum Package



You can find and git "Chatter Package" on Github.

Watch more laravel video tutorial.

Build Simple Laravel Admin Panel



Don't forget like, share and subscribe our channel. Click on Here.

See you next lessons ....

Laravel 5 Forum Tutorial : Simple Laravel 5.3 Forum Package with Chatter Plugin


Laravel 5.3 Forum Package Tutorial - How to build simple forum in Laravel 5.3 with "Chatter Package", This lessons will show you how to step by step create Forum Apps in Laravel project. At the previews lessons we have learn about build Laravel Admin panel using "Voyager" Package. Please Read :

Laravel Dashboard Package Example with Voyager.

Video Tutorial Simple Laravel 5.3 Forum Package



You can find and git "Chatter Package" on Github.

Watch more laravel video tutorial.

Build Simple Laravel Admin Panel



Don't forget like, share and subscribe our channel. Click on Here.

See you next lessons ....

Laravel 5 Admin Panel Tutorial : Laravel Dashboard Package Example with Voyager


Laravel 5.3 Admin Panel Tutorial - How to build laravel 5 dashboard package example with "Voyager" pakcage made with simple step. at previews lessons, we have create admin panel with "Build Blog Project", please read :

CRUD on Admin Panel Backend Services

Video Tutorial Build Laravel Admin Panel

This lessons will show you simple step using "Voyager". Voyager is a Laravel Admin Package that includes BREAD (CRUD) operations, a media manager, menu builder, and much more.



You can git "Voyager" on Github.

More laravel video tutorial is available here

Build Blog using Laravel 5.3



You can find all laravel tutorial live coding at youtube, or click here.
Don't forget to Like, Share and subscribe our channel for more tutorial sending to your email everyday.

See you next lessons...

Laravel 5 Admin Panel Tutorial : Laravel Dashboard Package Example with Voyager


Laravel 5.3 Admin Panel Tutorial - How to build laravel 5 dashboard package example with "Voyager" pakcage made with simple step. at previews lessons, we have create admin panel with "Build Blog Project", please read :

CRUD on Admin Panel Backend Services

Video Tutorial Build Laravel Admin Panel

This lessons will show you simple step using "Voyager". Voyager is a Laravel Admin Package that includes BREAD (CRUD) operations, a media manager, menu builder, and much more.



You can git "Voyager" on Github.

More laravel video tutorial is available here

Build Blog using Laravel 5.3



You can find all laravel tutorial live coding at youtube, or click here.
Don't forget to Like, Share and subscribe our channel for more tutorial sending to your email everyday.

See you next lessons...

Chủ Nhật, 11 tháng 12, 2016

Android Tutorial : Android Hello World Example with Android Studio


Android Studio tutorial : How to getting started build simple android application using Android Studio, this lessons will show you how to create "Hello World Example" in Android Studio. At the previews lessons, we have learn how to install and configure android studio on windows. Please Read :
How to Install Android Studio on Windows

Video Tutorial How to Create First App on Android Studio



Video tutorial Running App with Virtual Devices



Don't forget to like, share and subscribe our channel on youtube.

More Android tutorial's is here



see you next lessons ...

Android Tutorial : Android Hello World Example with Android Studio


Android Studio tutorial : How to getting started build simple android application using Android Studio, this lessons will show you how to create "Hello World Example" in Android Studio. At the previews lessons, we have learn how to install and configure android studio on windows. Please Read :
How to Install Android Studio on Windows

Video Tutorial How to Create First App on Android Studio



Video tutorial Running App with Virtual Devices



Don't forget to like, share and subscribe our channel on youtube.

More Android tutorial's is here



see you next lessons ...

Thứ Tư, 7 tháng 12, 2016

Laravel 5 Tutorial : How to Implement DataTables Ajax with yajra datatables


Laravel 5.3 Ajax Tutorial - How to implement DataTables Ajax with yajra datatables package in laravel 5.3, this tutorial will show you how to display, shorting, searching data from database using datatables ajax plugin in laravel 5.3

at the previews lessons, we have create simple Laravel 5.3 project, please read :
  1. Laravel 5.3 Ajax CRUD Application
  2. Laravel 5.3 Vue.Js CRUD Application
  3. Laravel 5.3 CRUD with Resource Controller
  4. Laravel 5.3 AngularJS CRUD Application

Video Tutorial Implement DataTables Ajax with yajra datatables



Full Source Code Implement DataTables Ajax with yajra datatables

First, we need to install Laravel Datatables Package

Install Laravel Datatables Package

composer require yajra/laravel-datatables-oracle

Next, Add Datatables Service Provider and Facade into config/app.php

...
Yajra\Datatables\DatatablesServiceProvider::class,
...

and

...
'Datatables' => Yajra\Datatables\Facades\Datatables::class,
...

Next, publish the configuration file.

php artisan vendor:publish

Controller (app\Http\Controllers\Auth\PostsController.php)

// use datatables
use Yajra\Datatables\Datatables;

Function Show data using DataTables

  // show datatables page
  public function datatables(){
    return view('admin/posts/datatables');
  }

  // show all posts data
  public function postsdata(){
    return Datatables::of(\App\Posts::all())->make(true);
  }

Routes (Web.php)

  // datatables route
  Route::get('admin/posts/datatables', 'Auth\PostsController@datatables');
  Route::get('admin/posts/postsdata', 'Auth\PostsController@postsdata');

Views (resources\views\admin\posts\datatables.blade.php)

@extends('layouts.dashbord')
@section('content')
  <h2 class="sub-header">Simple DataTables in laravel 5.3</h2>
  <div class="row">
    <div class="col-md-9">
      <a href="{{ url('admin/posts/new-post')}}" class="btn btn-primary btn-sm">Add New Post</a>
    </div>
<br>
  </div>
  <div class="table-responsive">
    <table class="table table-striped" id="allposts">
      <thead>
      <tr>
        <th>Id</th>
        <th>Title</th>
        <th>Description</th>
        <th>Created</th>
      </tr>
    </thead>
    <tbody>
    </tbody>
    </table>
  </div>
@stop

@push('scripts')
<script type="text/javascript">
  $(function(){
    $('#allposts').DataTable({
      processing: true,
      serverSide: true,
      ajax: '{!! URL::asset('admin/posts/postsdata') !!}',
      columns : [
        { data: 'id', name: 'id' },
        { data: 'title', name: 'title' },
        { data: 'description', name: 'description' },
        { data: 'updated_at', name: 'updated_at' }
      ]
    });
  });
</script>
@endpush

Master Blade Templates (resources\views\layouts\dashbord.blade.php)

in your master blade, add this line in the body tag

<!-- jQuery -->
<script src="//code.jquery.com/jquery.js"></script>
<!-- DataTables -->
<script src="//cdn.datatables.net/1.10.7/js/jquery.dataTables.min.js"></script>

@stack('scripts')


More Laravel Tutorial

Laravel 5.3 CRUD with VueJS


Laravel 5.3 CRUD with AJAX


Laravel 5.3 CRUD with Resource Controller



See you next lessons ....

Laravel 5 Tutorial : How to Implement DataTables Ajax with yajra datatables


Laravel 5.3 Ajax Tutorial - How to implement DataTables Ajax with yajra datatables package in laravel 5.3, this tutorial will show you how to display, shorting, searching data from database using datatables ajax plugin in laravel 5.3

at the previews lessons, we have create simple Laravel 5.3 project, please read :
  1. Laravel 5.3 Ajax CRUD Application
  2. Laravel 5.3 Vue.Js CRUD Application
  3. Laravel 5.3 CRUD with Resource Controller
  4. Laravel 5.3 AngularJS CRUD Application

Video Tutorial Implement DataTables Ajax with yajra datatables



Full Source Code Implement DataTables Ajax with yajra datatables

First, we need to install Laravel Datatables Package

Install Laravel Datatables Package

composer require yajra/laravel-datatables-oracle

Next, Add Datatables Service Provider and Facade into config/app.php

...
Yajra\Datatables\DatatablesServiceProvider::class,
...

and

...
'Datatables' => Yajra\Datatables\Facades\Datatables::class,
...

Next, publish the configuration file.

php artisan vendor:publish

Controller (app\Http\Controllers\Auth\PostsController.php)

// use datatables
use Yajra\Datatables\Datatables;

Function Show data using DataTables

  // show datatables page
  public function datatables(){
    return view('admin/posts/datatables');
  }

  // show all posts data
  public function postsdata(){
    return Datatables::of(\App\Posts::all())->make(true);
  }

Routes (Web.php)

  // datatables route
  Route::get('admin/posts/datatables', 'Auth\PostsController@datatables');
  Route::get('admin/posts/postsdata', 'Auth\PostsController@postsdata');

Views (resources\views\admin\posts\datatables.blade.php)

@extends('layouts.dashbord')
@section('content')
  <h2 class="sub-header">Simple DataTables in laravel 5.3</h2>
  <div class="row">
    <div class="col-md-9">
      <a href="{{ url('admin/posts/new-post')}}" class="btn btn-primary btn-sm">Add New Post</a>
    </div>
<br>
  </div>
  <div class="table-responsive">
    <table class="table table-striped" id="allposts">
      <thead>
      <tr>
        <th>Id</th>
        <th>Title</th>
        <th>Description</th>
        <th>Created</th>
      </tr>
    </thead>
    <tbody>
    </tbody>
    </table>
  </div>
@stop

@push('scripts')
<script type="text/javascript">
  $(function(){
    $('#allposts').DataTable({
      processing: true,
      serverSide: true,
      ajax: '{!! URL::asset('admin/posts/postsdata') !!}',
      columns : [
        { data: 'id', name: 'id' },
        { data: 'title', name: 'title' },
        { data: 'description', name: 'description' },
        { data: 'updated_at', name: 'updated_at' }
      ]
    });
  });
</script>
@endpush

Master Blade Templates (resources\views\layouts\dashbord.blade.php)

in your master blade, add this line in the body tag

<!-- jQuery -->
<script src="//code.jquery.com/jquery.js"></script>
<!-- DataTables -->
<script src="//cdn.datatables.net/1.10.7/js/jquery.dataTables.min.js"></script>

@stack('scripts')


More Laravel Tutorial

Laravel 5.3 CRUD with VueJS


Laravel 5.3 CRUD with AJAX


Laravel 5.3 CRUD with Resource Controller



See you next lessons ....