Laravel parse error: syntax error, unexpected T_CLASS, expecting T_STRING or T_VARIABLE

Laravel 5.1 uses the ::class property to get string representations of a fully qualified classname. The error you’re seeing is caused by this line $kernel = $app->make(Illuminate\Contracts\Http\Kernel::class); This language feature has been introduced in PHP 5.5 which is a requirement of Laravel 5.1. Your installed PHP version is probably older than 5.5. Try to update … Read more

Laravel 5.7 + Font Awesome

Laravel 5.7 through 7.x using Font Awesome 5 (The Right Way) Build your webpack.mix.js configuration. mix.setResourceRoot(‘../’); mix.setPublicPath(‘public’) mix.js(‘resources/js/app.js’, ‘public/js’) .sass(‘resources/sass/app.scss’, ‘public/css’); Install the latest free version of Font Awesome via a package manager like npm. npm install @fortawesome/fontawesome-free –save-dev This dependency entry should now be in your package.json. // Font Awesome “devDependencies”: { “@fortawesome/fontawesome-free”: “^5.15.3”, … Read more

Laravel Eloquent Relations: ->latest()

latest() is a function defined in Illuminate\Database\Query\Builder Class. It’s job is very simple. This is how it is defined. public function latest($column = ‘created_at’) { return $this->orderBy($column, ‘desc’); } So, It will just orderBy with the column you provide in descending order with the default column will be created_at.

Laravel change migration order

Roll back all the migrations (or start with a fresh database); Change the dates that form the first part of the migration filenames so they’re in the order you want (eg. for 2014_06_24_134109_update_database.php, the date & time is 2014-06-24, 13:41:09); Run the migrations again. With respect to your comment about foreign keys… I’m not sure … Read more