update model in laravel code example

Example 1: laravel soft delete

/** in migrations this changes need to
    add for table we want to add soft delete (LARAVEL)*/

	/** The migrations. START */
	public function up()
	{
		Schema::table('users', function(Blueprint $table)
		{
			$table->softDeletes();
		});
	}
	/** The migrations. END */

	/** after adding softdelete you need to
    point that column in table related model (LARAVEL)*/

	/** The Model. START */
  	use Illuminate\Database\Eloquent\SoftDeletes;
  	class User extends Model {
	  use SoftDeletes;
	  protected $dates = ['deleted_at'];
	}
	/** The Model. END */

Example 2: php artisan make model

php artisan make:model Flight

Example 3: larave Soft Deletes

Schema::table('flights', function (Blueprint $table) {
    $table->softDeletes();
});

Example 4: laravel scope

public function apply(Builder $builder, Model $model)
    {
        $builder->where('age', '>', 200);
    }

Example 5: laravel model::query

// Eloquent's Model::query() returns the query builder

Model::where()->get();
// Is the same as 
Model::query()->where()->get();

Model::query();
// Can be useful to add query conditions based on certain requirements

// See https://stackoverflow.com/questions/51517203/what-is-the-meaning-of-eloquents-modelquery

Example 6: create new record via model in laravel

$userData = array('username' => 'Me', 'email' => 'me@yahoo.com');
User::create($userData);