laravel

Laravel Redirect To Login Page After Successful Verification

谁说胖子不能爱 提交于 2021-02-19 09:42:33
问题 I implements MustVerifyEmail to verify registered user. What I want is it will redirect to login page after successful verification by email. Trying to do this, but still, it keep redirect to /home. VerificationController.php class VerificationController extends Controller { /* |-------------------------------------------------------------------------- | Email Verification Controller |-------------------------------------------------------------------------- | | This controller is responsible

Laravel Redirect To Login Page After Successful Verification

丶灬走出姿态 提交于 2021-02-19 09:41:28
问题 I implements MustVerifyEmail to verify registered user. What I want is it will redirect to login page after successful verification by email. Trying to do this, but still, it keep redirect to /home. VerificationController.php class VerificationController extends Controller { /* |-------------------------------------------------------------------------- | Email Verification Controller |-------------------------------------------------------------------------- | | This controller is responsible

Export large CSV file using laravel

我怕爱的太早我们不能终老 提交于 2021-02-19 08:37:27
问题 I have to export 600k database rows with a belongsTo relationship between two tables to a csv file using a queued job in laravel 5.2, it works fine when I do not include the information from the second table, but it reaches memory limit or timeout I guess (there is no error on the output, the job just stops and the file blocks at ~8MB) when I include the second table. Here is my handle function from my job : public function handle() { $request = $this->request; $ts = Carbon::now()->timestamp;

laravel orm : where condition on table -> related table -> related table

倾然丶 夕夏残阳落幕 提交于 2021-02-19 07:54:25
问题 so here is my database for a book store books : id ,title category : id, title book_category : id , book_id, category_id book_stock : id , book_id , quantity , price considering all the relations are defined in the model , i can query book_stock it goes something like this Stock::with('Book')->get(); but what if i want to get stock of a book in the category = 1 i can use use condition on book Stock::with('Book' , function($q){ $q->where(['title'=>'abc']); })->get(); but how can i filter

Laravel eloquent withCount() supposed to be slower than just with()

孤街醉人 提交于 2021-02-19 07:51:25
问题 So the reason i ask this is that in my current app withCount() almost triples the response time vs just fetching all the data for the relationship via with() and just getting the length from the frontend (javascript). I thought the point of using withCount() was to speed up the query but maybe i'm wrong? for example: courseSession::where('id', '>=', 1) ->where('id', '<=', 320) ->withCount('enrollments') ->get(); averages around 900ms response (debugbar shows this as a single DB call) but

Laravel Eloquent object, longtext being truncated

拜拜、爱过 提交于 2021-02-19 07:18:25
问题 I've using Laravel, loading a db row into an Eloquent object. One of the columns is longtext, a JSON encoded array > 2 million characters long. The original error I was getting was json_decode failing on this column's value. I tested in tinker. Simplified test code: $item = Item::find(1); echo $item->long_text_field; var_dump(json_decode($item->long_text_field)); echo strlen($item->long_text_field); On my local vagrant instance this shows the correct values. ...long json array in text, same

Laravel Eloquent object, longtext being truncated

做~自己de王妃 提交于 2021-02-19 07:12:58
问题 I've using Laravel, loading a db row into an Eloquent object. One of the columns is longtext, a JSON encoded array > 2 million characters long. The original error I was getting was json_decode failing on this column's value. I tested in tinker. Simplified test code: $item = Item::find(1); echo $item->long_text_field; var_dump(json_decode($item->long_text_field)); echo strlen($item->long_text_field); On my local vagrant instance this shows the correct values. ...long json array in text, same

Laravel Eloquent object, longtext being truncated

主宰稳场 提交于 2021-02-19 07:12:39
问题 I've using Laravel, loading a db row into an Eloquent object. One of the columns is longtext, a JSON encoded array > 2 million characters long. The original error I was getting was json_decode failing on this column's value. I tested in tinker. Simplified test code: $item = Item::find(1); echo $item->long_text_field; var_dump(json_decode($item->long_text_field)); echo strlen($item->long_text_field); On my local vagrant instance this shows the correct values. ...long json array in text, same

Laravel with datatables: searching encrypted data

南楼画角 提交于 2021-02-19 06:26:06
问题 I have encountered a great issue while using Laravel's datatables. I have a model that has 3 values automatically encrypted (using Crypt) by setter/getter. I am using datatables to render a table by doing so: return datatables()->of(Patient::query()) ->addColumn('name_surname', function($row){ return $row->name.' '.$row->surname; }) ->make(true); There is 3 ways to pass a model to datatable: by query (Patient::query()) by collection (Patient::all()) by DB facade The third doesnt decrypt data.

Run Vue.js and Laravel on the same server (same port)

半世苍凉 提交于 2021-02-19 05:38:13
问题 I am developing a website using Laravel as backend and Vue.js 2 as frontend. Now everytime i want to run my website I have to use 2 command: php artisan serve This will run the laravel server on port 8000 npm run dev This will run the vue.js server on port 8080 Can I just run them on the same server (same port), with just one command only?? 回答1: If you use the Laravel app with Vue.js included in it, you don't need to run npm run dev . In your case, you seem to have a decoupled frontend and