Laravel Redirect Index to Public

Edit your htaccess file. This alone will redirect your root o the public folder. If you have a lot inside of your htaccess file. Be careful while adding stuff. Ensure you keep a backup before editing and test the addition of the code inside the htaccess file....

Laravel Class Construct

class MyCustomClassName { public function __construct() { } public function whatever_whatever(){ // Code goes here. And can use anything from the construct. The construct will always load first }...

Why we have classes and controllers in MVC?

A Controller or Class in MVC are both just classes. So… Technically speaking. It is possible to write all your functionality inside your controllers and completely ditch the classes folder. But! The purpose of breaking out into separate classes is re-usability....

Laravel Save Function, update and add with exceptions

Save Function (Update and Add in 1 function based on ID) <?php namespace App\Http\Controllers; use Illuminate\Support\Facades\DB; use Illuminate\Http\Request; class RandomController extends WhateverWhateverController { public function saveTermsAndConditions(Request...

Laravel Raw Query The DB with Prepared Statement

Required Laravel includes use Illuminate\Support\Facades\DB; use Illuminate\Http\Request; Select Query class MySpecialController extends Controller { public function rawQueryFunctionNameSelect(Request $request){ $rawQuery= DB::select( DB::raw( ‘SELECT * FROM...

Pin It on Pinterest