laravel

Testing listeners with Queue::fake()

江枫思渺然 提交于 2021-02-06 15:17:33
问题 My Laravel 5.5 application has a Product model. The Product model has a dispatchesEvents property that looks like this: /** * The event map for the model. * * @var array */ protected $dispatchesEvents = [ 'created' => ProductCreated::class, 'updated' => ProductUpdated::class, 'deleted' => ProductDeleted::class ]; I also have a listener that is called CreateProductInMagento which is mapped to the ProductCreated event in the EventServiceProvider . This listener implements the ShouldQueue

how can i search multiple keywords in laravel .?

大城市里の小女人 提交于 2021-02-06 13:55:22
问题 This is my controller $term = $request->get('q'); // return $request->q; $products = Post::whereHas('user', function($query) use($term) { $query->where('name', 'like', '%'.$term.'%'); })->orWhere('tags','LIKE','%'.$term.'%')->get(); return view('pages.search', compact('products','users')); This is working good for single keyword search. But I want to use it for multiple keywords. Like laravel php etc. Please guide me when I search multiple values like abc php laravel or anything then it

Laravel 5.5 Consolidate migrations w/ production database

廉价感情. 提交于 2021-02-06 11:05:08
问题 Hopefully, I can explain this well. I have a Laravel application that has been in production for a minute. So, I have a bunch of migration files with a lot of changes. I would like to consolidate these migration files without losing the database. The way I think this would work: Get all production tables migrated to the desired state. Consolidate all the migration files into the minimum number of files needed. Clear the migrations table. Either run migrations or populate the migrations table.

Laravel 5.5 Consolidate migrations w/ production database

两盒软妹~` 提交于 2021-02-06 11:02:02
问题 Hopefully, I can explain this well. I have a Laravel application that has been in production for a minute. So, I have a bunch of migration files with a lot of changes. I would like to consolidate these migration files without losing the database. The way I think this would work: Get all production tables migrated to the desired state. Consolidate all the migration files into the minimum number of files needed. Clear the migrations table. Either run migrations or populate the migrations table.

Laravel 5.5 Consolidate migrations w/ production database

℡╲_俬逩灬. 提交于 2021-02-06 11:01:46
问题 Hopefully, I can explain this well. I have a Laravel application that has been in production for a minute. So, I have a bunch of migration files with a lot of changes. I would like to consolidate these migration files without losing the database. The way I think this would work: Get all production tables migrated to the desired state. Consolidate all the migration files into the minimum number of files needed. Clear the migrations table. Either run migrations or populate the migrations table.

Laravel 5.5 Consolidate migrations w/ production database

我只是一个虾纸丫 提交于 2021-02-06 11:01:43
问题 Hopefully, I can explain this well. I have a Laravel application that has been in production for a minute. So, I have a bunch of migration files with a lot of changes. I would like to consolidate these migration files without losing the database. The way I think this would work: Get all production tables migrated to the desired state. Consolidate all the migration files into the minimum number of files needed. Clear the migrations table. Either run migrations or populate the migrations table.

Laravel 5.5 Consolidate migrations w/ production database

[亡魂溺海] 提交于 2021-02-06 11:01:07
问题 Hopefully, I can explain this well. I have a Laravel application that has been in production for a minute. So, I have a bunch of migration files with a lot of changes. I would like to consolidate these migration files without losing the database. The way I think this would work: Get all production tables migrated to the desired state. Consolidate all the migration files into the minimum number of files needed. Clear the migrations table. Either run migrations or populate the migrations table.

Laravel Echo - Allow guests to connect to presence channel

蹲街弑〆低调 提交于 2021-02-06 10:57:20
问题 I am using laravel-echo-server to run Laravel Echo to broadcast events. I have a user counter channel which shows all the users on the app. For this I am using a presence channel. This works fine for logged in users, but guests just never get connected. I've setup the below in the BroadcastServiceProvider: Broadcast::channel('global', function () { return ['name' => 'guest']; }); Which from what I can tell, should allow everyone in as 'guests'. I'm guessing there's some middleware or auth

Composite keys laravel schema builder

余生长醉 提交于 2021-02-06 10:15:06
问题 I need two composite primary keys and only one should be AUTO INCREMENT what I tried so far: // first try Schema::create("kitchen", function($table) { $table->increments('id'); $table->integer('restaurant_id'); $table->primary(array('id', 'restaurant_id')); $table->string('name'); }); // second try Schema::create("kitchen", function($table) { $table->increments('id'); $table->integer('restaurant_id'); $table->primary('restaurant_id'); $table->string('name'); }); None works. Error message:

Composite keys laravel schema builder

元气小坏坏 提交于 2021-02-06 10:13:52
问题 I need two composite primary keys and only one should be AUTO INCREMENT what I tried so far: // first try Schema::create("kitchen", function($table) { $table->increments('id'); $table->integer('restaurant_id'); $table->primary(array('id', 'restaurant_id')); $table->string('name'); }); // second try Schema::create("kitchen", function($table) { $table->increments('id'); $table->integer('restaurant_id'); $table->primary('restaurant_id'); $table->string('name'); }); None works. Error message: