docker-compose up -d docker-compose up -d --build | <?php | |
| // SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes | |
| use Illuminate\Support\Facades\Schema; | |
| public function boot() | |
| { | |
| Schema::defaultStringLength(191); | |
| } |
| <?php | |
| // The issue this solves is to allow the user to upload a document and for us to save the document such that: the document is zip'd, the zip file is given a unique name, the zip file is password protected with a unique password, the password is encrypted for storage in the db table. | |
| // The following will allow for creating one codeset to be called for the creation of all Documents. | |
| // For the moment, we will need to set up IF statements for the statement that creates an instance of $Document | |
| // which will allow for us to create a new entry in the appropriate database table. | |
| public function storeInitDocument($request, $id, $theUserID, $ignore, $tableName){ | |
| // This function will determine if the User has uploading any documents. If so, the document's properties will be stored, | |
| // followed by the storage of the physical document with a unique name. The document will be |
| <?php | |
| // After setting the environment variables, we can go ahead and create a new Database. We can utilize the power of PHP artisan here with Laravel commands. | |
| # Step 1 | |
| // Fire up the command line and navigate to the project’s root directory Run the following command – php artisan make:command CreateMySQLDb | |
| # Step 2 | |
| // In the code editor file explorer, locate the new command file which is named CreateMySQLDb.php within the following folder app/Console/Commands. Edit the contents to look like the following snippet and save it. |
| <?php | |
| // routes/web.php | |
| Route::get('auto-login', function() { | |
| // Only available in local environment | |
| abort_unless(app()->environment('local'), 403); | |
| // Login with first user from DB seeds | |
| auth()->login(User::first()); | |
| Common syntax | Shorter and more readable syntax |
|---|---|
| Session::get('cart') | session('cart') |
| $request->session()->get('cart') | session('cart') |
| Session::put('cart', $data) | session(['cart' => $data]) |
| $request->input('name'), Request::get('name') | $request->name, request('name') |
| return Redirect::back() | return back() |
| is_null($obj->relation) ? null : $obj->relation->id | optional($obj->relation)->id |
| return view('index')->with('title', $title)->with('client', $client) | return view('index', compact('title', 'client')) |
| request->has('value') ? request->value : 'default' | request->get('value', 'default') |
| composer install --optimize-autoloader --no-dev | |
| php artisan route:cache | |
| php artisan config:cache | |
| php artisan view:cache | |
| php artisan event:cache |
| <?php | |
| // Setup: | |
| abstract class TestCase extends BaseTestCase | |
| { | |
| use CreatesApplication; | |
| protected function setUp(): void | |
| { |
| <?php | |
| use Illuminate\Database\Eloquent\Builder; | |
| Builder::macro('toSqlWithBindings', function () { | |
| $bindings = array_map( | |
| fn ($value) => is_numeric($value) ? $value : "'{$value}'", | |
| $this->getBindings() | |
| ); |