「 Laravel 」 一覧
-
言語系 Japanese Language Pack / 日本語言語パック envファイル .env files support 変数名変換系(スネーク、キャメル) String Manipulati …
-
PHPフレームワーク Laravel Webアプリケーション開発 バージョン8.x対応 [ 竹澤 有貴 ] のメモ
PHPフレームワーク Laravel Webアプリケーション開発 バージョン8.x対応 [ 竹澤 有貴 ] 価格:4180円(税込、送料無料) (2022/7/22時点) 楽天で購入 俺 …
-
モデル周り
123456789101112131415161718192021222324Schema::create('user_mails', function (Blueprint $table) {$table->bigIncrements('user_mail_id');$table->bigInteger('user_id')->unsigned()->comment('ユーザーID');$table->timestamps();$table->softDeletes();$table->foreign('user_id')->references('user_id')->on('users');});protected $fillable = ['user_id',];=Userpublic function userMails(): HasMany{return $this->hasMany('App\Models\UserMail', 'user_id');}=UserMailpublic function user(): BelongsTo{return $this->belongsTo('App\Models\User', 'user_id');}データ抽出
123456789101112131415$query = User::leftJoin('user_mails', function ($join) {$join->on('users.user_id', '=', 'user_mails.user_id')->whereNull('user_mails.deleted_at');});$query->select(['users.email',\DB::raw('(case when user_mails.user_mail_id is not null then 1 else 0 end) as is_mail')]);$query->where('user_mails.user_mail_id', 1);$query->where(function ($subQuery) use ($keyword) {$subQuery->where('users.name', 'LIKE', "%{$keyword}%")->orWhere('users.email', 'LIKE', "%{$keyword}%");});
-
Laravel6のartisanコマンド一覧です。
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110$ php artisan listLaravel Framework 6.20.2Usage:command [options] [arguments]Options:-h, --help Display this help message-q, --quiet Do not output any message-V, --version Display this application version--ansi Force ANSI output--no-ansi Disable ANSI output-n, --no-interaction Do not ask any interactive question--env[=ENV] The environment the command should run under-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debugAvailable commands:clear-compiled Remove the compiled class filedown Put the application into maintenance modeenv Display the current framework environmenthelp Displays help for a commandlist Lists commandsmigrate Run the database migrationsoptimize Cache the framework bootstrap filespreset Swap the front-end scaffolding for the applicationserve Serve the application on the PHP development servertinker Interact with your applicationui Swap the front-end scaffolding for the applicationup Bring the application out of maintenance modeauthauth:clear-resets Flush expired password reset tokenscachecache:clear Flush the application cachecache:forget Remove an item from the cachecache:table Create a migration for the cache database tableconfigconfig:cache Create a cache file for faster configuration loadingconfig:clear Remove the configuration cache filedbdb:seed Seed the database with recordsdb:wipe Drop all tables, views, and typeseventevent:cache Discover and cache the application's events and listenersevent:clear Clear all cached events and listenersevent:generate Generate the missing events and listeners based on registrationevent:list List the application's events and listenerskeykey:generate Set the application keymakemake:channel Create a new channel classmake:command Create a new Artisan commandmake:controller Create a new controller classmake:event Create a new event classmake:exception Create a new custom exception classmake:factory Create a new model factorymake:job Create a new job classmake:listener Create a new event listener classmake:mail Create a new email classmake:middleware Create a new middleware classmake:migration Create a new migration filemake:model Create a new Eloquent model classmake:notification Create a new notification classmake:observer Create a new observer classmake:policy Create a new policy classmake:provider Create a new service provider classmake:request Create a new form request classmake:resource Create a new resourcemake:rule Create a new validation rulemake:seeder Create a new seeder classmake:test Create a new test classmigratemigrate:fresh Drop all tables and re-run all migrationsmigrate:install Create the migration repositorymigrate:refresh Reset and re-run all migrationsmigrate:reset Rollback all database migrationsmigrate:rollback Rollback the last database migrationmigrate:status Show the status of each migrationnotificationsnotifications:table Create a migration for the notifications tableoptimizeoptimize:clear Remove the cached bootstrap filespackagepackage:discover Rebuild the cached package manifestqueuequeue:failed List all of the failed queue jobsqueue:failed-table Create a migration for the failed queue jobs database tablequeue:flush Flush all of the failed queue jobsqueue:forget Delete a failed queue jobqueue:listen Listen to a given queuequeue:restart Restart queue worker daemons after their current jobqueue:retry Retry a failed queue jobqueue:table Create a migration for the queue jobs database tablequeue:work Start processing jobs on the queue as a daemonrouteroute:cache Create a route cache file for faster route registrationroute:clear Remove the route cache fileroute:list List all registered routesscheduleschedule:run Run the scheduled commandssessionsession:table Create a migration for the session database tablestoragestorage:link Create a symbolic link from "public/storage" to "storage/app/public"uiui:auth Scaffold basic login and registration views and routesvendorvendor:publish Publish any publishable assets from vendor packagesviewview:cache Compile all of the application's Blade templatesview:clear Clear all compiled view files