lareavel soft delte code example
Example 1: laravel observer
<?php
namespace App\Providers;
use App\Observers\UserObserver;
use App\Models\User;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
User::observe(UserObserver::class);
}
}
Example 2: @foreac laravel
public function __construct()
{
$this->middleware('auth');
}
/**
* Show the application dashboard.
*
* @return \Illuminate\Contracts\Support\Renderable
*/
public function index()
{
return view('home');
}
Example 3: laravel controller not updating method
Check that you are not having two or more classes with the same name in any of your controllers
Example 4: @foreac laravel
Route::get('/', 'PageController@index');
Route::get('/welcome','PageController@Welcome');
Route::get('/services', 'PageController@services');
Route::get('/register', 'PageController@register');
Route::get('/Create', 'PageController@Create');
Route::get('/search', 'PageController@search');
Route::get('/payment', 'PageController@Payment');
Route::resource('posts', 'PostsController');
Route::resource('search', 'SearchController');
Route::resource('reviews', 'ReviewsController');