Sunday 30 April 2017

Laravel 5.4 dropdown default from database

Laravel we have more and more options Like drop-down selection from database records.

Take a simple example permissions and roles. I have to add a role with some permissions.

So I have to call permissions from the database.

RoleController:
$permissions = Permission::where('active_flag', 1)->orderBy('name')->pluck('name', 'id');
return view('roles.create',compact('permissions'));

 roles.create:


  <div class="form-group"> 
 {!! Form::label('permissions', 'Permissions:') !!} 
 {!! Form::select('permissions',$permissions, null,['id'=>'multiple-checkboxes','multiple'=>'multiple'] ) !!}
 </div>


Here I am using multiple dropdown.
Simply we can add roles with permissions.



Tuesday 25 April 2017

Laravel 5.4 when migrating getting too long error

I can fix this by going in the migration for the user's table, and manually specifying the max-length of the email field, like so:

$table->string('email', 250)->unique();

As outlined in the Migrations guide to fix this all you have to do is edit your AppServiceProvider.php file and inside the boot method set a default string length:

use Illuminate\Support\Facades\Schema;
public function boot()
{
    Schema::defaultStringLength(191);

cURL error 60: SSL certificate problem: unable to get local issuer certificate (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) in Laravel

  WampServer: Download this file:  http://curl.haxx.se/ca/cacert.pem Place this file in the  C:\wamp64\bin\php\php7.1.9  folder Open  php.in...

Popular Articles