Laravel
フロントからクエリパラメーターを二つ付けて送った where では intval() で型を変える必要があったがforPage() では $request->page のままで処理が可能だったことに注意 //
updated: 2018/10/3 @vue ?page=1 のクエリを添えてGET @laravel $request->page で欲しいpage番号を指定 forPage() はpage1 と page2以降で返り値の挙動に差があるエラーがあるので下記参照 github.com // gist.github.com
updated: 2021/6/1 jenssegers/mongodb の mysql relationships で使用可能なことが確認済み php artisan make:factory FACTORY_NAME factory1 factory2 seeds/DatabaseSeeder.php おまけ ランダムな文字列を生成 return [ 'randomText' => $faker->regexify…
データベーステーブルを適切に削除しなかったため。 solution: php artisan migrate:refresh //
Updated: 2018/9/27 php7.2 を cloud9 にインストール monteecristoo.hatenablog.com MongoDB のインストール monteecristoo.hatenablog.com PHP 用の MongoDB ドライバーをインストール PHP: Installing the MongoDB PHP Driver with PECL - Manual sudo pe…
updated: 2022/2/18 より良い方法: monteecristoo.hatenablog.com blade template 内の vue component にデータをパスしたい場合 例えば authHome.blade.php / guestHome.blade.php の二つに共通で PageBody.vue という vue component を使うとき、Laravel …
updated: 2018/5/2 この記事は検証途中で内容が不正確 方法1 Laravel Mix から @webpack.mix.js let webpack = require('webpack'); mix.webpackConfig({ plugins: [ new webpack.ProvidePlugin({ $: 'jquery', jquery: 'jquery', window.jquery: 'jquery' …
// mix.js('resources/assets/js/app.js', 'public/js') .js('resources/assets/js2/app2.js', 'public/js/app2.js') .sass('resources/assets/scss/app.scss', 'public/css') .sass('resources/assets/scss/style.scss', 'public/css') .sass('resources/as…
// App\User ===> App\MongoMessage Mysql Relationships App\MessageGroup ===> App\MongoMessage hasMany Relationships App\User public function mongoMessages() { return $this->hasMany(MongoMessage::class); } App\MessageGroup public function mo…
// updated: 2018/4/14 first() get() >>> get() で複数の collection が返ってくるのでさらに処理したい場合は foreach で処理 e.g.) $messages = App\Message::whereNull("body")->get(); foreach($messages as $message) { $mssage->delete(); } whereIn(…
// setting up Mysql Relationships create the route and controller fetch the data from mongoDB extract the value from the response(3) fetch the data from Mysql using the value(4) return the response 1. @app\user use Jenssegers\Mongodb\Eloqu…
// @webpack.mix.js mix.js('resources/assets/js/app.js', 'public/js') .js('resources/assets/js2/app2.js', 'public/js'); @resources/assets/js/app.js app.js に実装したい routing, components を読み込むconst routes = [ { path: '/user/:id', comp…
// tinker $mongoUser = new MongoUser(['id' => 1, 'name' => 'Max']); $mongoMessage = new MongoMessage(['id' => 1, 'group' => '1', 'body' => 'Something', 'sender' => 'max', 'receiver' => 'Monica']); $mongoMessage = $mongoUser->mongoMessages(…
// App/MongoUser namespace App; use Moloquent; use MongoMessage; class MongoUser extends Moloquent{ protected $connection = 'mongodb'; protected $collection = 'mongoUsers'; public function mongoMessages() { return $this->embedsMany('MongoM…
// cloud9 上で php artisan migrate:reset 時に下記のエラー SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = c9 and table_name = migrations) composer dump-autoload してもダメな時 な…
// updated: 2018/3/6 jenssegers/laravel-mongodb を導入するメリット MySQL Relations If you're using a hybrid MongoDB and SQL setup, you're in luck! The model will automatically return a MongoDB- or SQL-relation based on the type of the rela…
// cloud9 で Laravel mix 使用時、下記のエラーが発生 cjpeg: error while loading shared libraries: libpng16.so.16 error write epipe エラーがどのタイミングで発生したか把握していない ubuntu 特有のエラーかも 環境: Ubuntu 14.04.5 LTS (cloud9) la…
updated: 2018 9/26 Error: In Database.php line 198: No suitable servers found ('serverSelectionTryOnce' set) : [connection refused calling ismaster on '127.0.0.1:27017'] mongoDB と mysql を使った multiple Database 環境で php artisan migrat…
// updated 2018/1/5 Installation monteecristoo.hatenablog.com monteecristoo.hatenablog.com Laravel Configuration @config\app.php add the service provider Jenssegers\Mongodb\MongodbServiceProvider::class, @config/database.php 'mongodb' => […
updated: 2018/9/25 jenssegers/laravel-mongodb installation PHP7.1 on cloud9 updated: 2017/12/14 下記に従ってmongoDBをインストール。 monteecristoo.hatenablog.com composer require jenssegers/mongodb → error: Problem 1 - jenssegers/mongodb v3…
Installation composer require predis/predis @web.php Route::get('/redis_test', function() { print_r(app()->make('redis')); } // Illuminate\Redis\RedisManager Object ( [driver:protected] => predis [config:protected] => Array ( [default] => …
// community.c9.io www.compose.com https://teratail.com/questions/41471
// Laravel で pusher を使った notification を受けて mailtrap 経由で通知メールを送る。 monteecristoo.hatenablog.com 上記の続き @.env mailtrap のアカウント情報を記入 MAIL_DRIVER=smtpMAIL_HOST=smtp.mailtrap.ioMAIL_PORT=2525MAIL_USERNAME=YOUR …
npm install noty --save @resources/assets/js/bootstrap.js window.noty = require('noty'); @app.blade.php <script> @if(Session::has('success')) new noty({ type: 'success', layout: 'bottomLeft', text: '{{ Session::get('success') }}' }); @endif </script> -----…
// Laravel Echo : A JavaScript library that makes it painless to subscribe to channels and listen for events broadcast by Laravel. Installation composer require pusher/pusher-php-server "~3.0" 参考: laravel.com Problem 1 - Installation re…
// composer.json ファイルを github.com をコピーしてペースト。 composer.jsonの自分でカスタマイズした部分をペースト。 composer update php artisan --version でアップデートを確認。 参考: laravel.com www.youtube.com
Laravel 内の Vue.js vue-loader@13.0.4にアップデートすると [Vue warn]: Failed to mount component: template or render function not defined. とエラーが出るので vue-loader@12.2.2 を使用(要検証) yarn add vue-loader@12.2.2
@relationships.php public function res_recommend() // users not follow { $fs = $this->follows()->get(); // Auth_userがfollowしているuser $follows = array(); foreach($fs as $f) { array_push($follows, $f->target_id); } array_push($follows, $…
// ORMにfunctionを追記出来るがreusableでなく、肥大化することがあるためtraitsを使うことがある。 TraitsやORMのfunctionはmethod chainやORM向けのmethodを使用できる点で優れる。 @App\foo.php (ORM) use App\Traits\Friendable; class User extends Au…
blade templateで@section('hoge')を設定したのち、 vue側のapp.jsでvueをinjectするタグを以下のように同じ<hoge>に設定すると… Vue.component('hoge', require('./componets/Hoge.vue')); エラー(コンソールにもコンパイル時もエラーが表示されない)でvueが表示</hoge>…