Laravel

Aus Vokabulabor
Zur Navigation springen Zur Suche springen

Links

Projekt einrichten

PROJ=langutor
PASSW=topsecret
BASE=/home/ws/php/$PROJ
cd $(basename $BASE)
composer create-project laravel/laravel $PROJ
cd $BASE
composer require laravel/ui
composer require spatie/laravel-permission
php artisan ui bootstrap --auth
dbtool create-db-and-user lrv$PROJ $PROJ "$PASSW"
sed -i -e "s/DB_DATABASE=.*/DB_DATABASE=lrv$PROJ" \
  -e "s/DB_USERNAME=.*/DB_USERNAME=$PROJ" \
  -e "s/DB_PASSWORD=.*/DB_USERNAME=$PASSWD" .env

M_HOST=mail.gmx.net
M_PORT=587
M_USER=example@gmx.de
M_PW=Top.Secret42
sed -i -e "s/MAIL_MAILER=.*/MAIL_MAILER=smtp" \
  -e "s/MAIL_HOST=.*/MAIL_HOST=$M_HOST" \
  -e "s/MAIL_PORT=.*/MAIL_PORT=$M_PORT" \
  -e "s/MAIL_USERNAME=.*/MAIL_USERNAME=$M_USER" \
  -e "s/MAIL_PASSWORD=.*/MAIL_PASSWORD=$M_PW" \
  -e "s/MAIL_ENCRYPTION=.*/MAIL_ENCRYPTION=STARTTLS" \
  -e "s/MAIL_FROM_ADDRESS=.*/MAIL_FROM_ADDRESS=\"$M_USER\"" .env

Bootstrap 5

  • app\Providers\AppServiceProvider.php
use Illuminate\Pagination\Paginator;
/**
 * Bootstrap any application services.
 *
 * @return void
 */
public function boot()
{
    Paginator::useBootstrapFive();
}

Install Laravel-Breeze (Authentification)

composer require laravel/breeze --dev
php artisan breeze:install blade
php artisan migrate

Projekt aktualisieren

npm install
npm run dev

Artisan Tipps

php artisan make:seeder PermissionSeeder
php artisan migrate:fresh --seed
php artisan make:controller RoleController --resource
php artisan make:request StoreRoleRequest
php artisan make:view users.index

Integrierter Webserver

php artisan serve