Please enable JavaScript.
Coggle requires JavaScript to display documents.
Laravel - Coggle Diagram
Laravel
Laravel
-
-
R
\$data = DB::table('table-name')->where()->get();\n\$data = Model::find();\n\$data = Model::where()->get();
C
-
without model
\$data = DB::table('table-name')->insert([\n 'row-name' => value,\n]);
Passing Variable
Method - 2\n\$data = DataBase::all();\nreturn view('index', compact('data'));
Method - 1\n\$data = DataBase::all();\nreturn view('index')->with('datas', \$data);
-
-
Authentication
-
with package
composer require laravel/breeze --dev
Middleware
Use Middleware in Controller\npublic function __construct() {\n \$this->middleware('auth', ['except'=>['index', 'show']]);\n// middleware not work with route name 'index' & 'show'\n}
-
Validation
In controller\n\$request->validate([\n 'request-name1' => 'rule-1|rule-2|...',\n 'request-name2' => 'rule-1|rule-2|...',\n]);\n// some rules has default error message in lang/en
In controller\n\$request->validate([\n 'request-name1' => 'rule-1|rule-2|...',\n 'request-name2' => 'rule-1|rule-2|...',\n]);\n// some rules has default error message in lang/en
-