Posts

Showing posts with the label create table

Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table `users` add unique `users_email_unique`(`email`))

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

laravel: command not found

export PATH="$HOME/.composer/vendor/bin:$PATH" source ~/.bash_profile

send data to view from controller in laravel

There are many ways to send data to views from controller i am assuming $data you have to send in view return view('layout',['data' => $data]); return view('layout',compact('data'));  return view('layout')->with(compact('data'));  return view('layout')->withData($data);  return view('layout')->with('data',$data);

Base table or view not found: 1146 Table 'links.blogs' doesn't exist

make sure you are using create instead of table. use Schema::create to create new. Schema::create('links', function (Blueprint $table) {       $table->increments('id');       $table->timestamps(); }); some this like this

create table through migration in laravel

php artisan make:migration create_YOUR_TABLE_NAME_table --create=YOUR_TABLE_NAME For example i am creating links table php artisan make:migration create_links_table --create=links this command will generate migration like this Schema::create('links', function (Blueprint $table) {       $table->increments('id');       $table->timestamps(); });