CSRF Protection

Cross-site request forgery (CSRF), also known as one-click attack or session riding, is a type of malicious exploit of a website where unauthorized commands are submitted from a trusted website user. Laravel makes it easy to protect your application from CSRF attacks by inspecting every incoming POST, PUT, PATCH, or DELETE for a secret session…

Laravel Helpers: Fluent Strings

<?php use Illuminate\Support\Str; //FLUENT STRINGS //after //returns everything after the given value in a string echo “<br>”.Str::of(‘My name is Rabie Akela’)->after(‘My name is’); //Rabie Akela //afterlast //returns everything after the last occurrence of the given value in a string echo “<br>”.Str::of(‘App\Http\Controllers\Controller’)->afterLast(‘\\’); //Controller //append //appends the given values to the string echo “<br>”.Str::of(‘Rabie’)->append(‘ Akela’); //Rabie Akela…

Laravel Helpers: Miscellaneous

Laravel Helpers are a variety of global “helper” PHP functions. The full list of helpers can be found here: https://laravel.com/docs/8.x/helpers Miscellaneous Helpers abort() The abort function throws an HTTP exception which will be rendered by the exception handler. The example below shows a 400 error.   if(! file_exists($myFile)){ abort(400);} dd() The dd function stands for…

Laravel: MVC Design Pattern

MVC Design Pattern Model (Eloquent) A models allows to view, insert, update, and delete records from a database table. Laravel includes Eloquent, an object-relational mapper (ORM) to interact with a database. When using Eloquent, each database table has a corresponding “Model” that is used to interact with that table.  View The view is what the…