laravel-5.3

Call to undefined method Illuminate\Database\Query\Builder::notify()

二次信任 提交于 2019-12-10 00:40:24
问题 Issue in Laravel 5.3.6 when submitted request in Forgot Password. Error Details Call to undefined method Illuminate\Database\Query\Builder::notify() Issue is in below file: vendor\laravel\framework\src\Illuminate\Auth\Passwords\PasswordBroker.php Line 69. Code is below $user->sendPasswordResetNotification( $this->tokens->create($user) ); Function: sendResetLink It was working fine in Laravel 5.2 and seems not working in 5.3.6 version. Have you faced this issue? 回答1: You must add Illuminate

fetching data before changing route with react-router

心不动则不痛 提交于 2019-12-09 23:50:06
问题 I'm using react , react-router , and redux with laravel on the backend and I'm using all the latest releases and I'm actually quite new to these, I just decided I should take my development experiences to the next level and decided to use these based on how I liked them, A LOT . I have the following problem: When I am in the about-us route, I then click Home but before router renders the home page , it needs to make an async call to the server. I notice that I theoretically need this to be

Multi-language indexes with Laravel Scout and Algolia

那年仲夏 提交于 2019-12-09 11:20:26
问题 How should I manage the multi-language indexes (For example: page / page_translations models should become page_en / page_fr indexes). I am using " Dimsav\Translatable " package. Page model : id, status_id, created_at, updated_at PageTranslation model : id, page_id, locale, title, slug, body Algolia offers support for this (https://www.algolia.com/doc/guides/search/multilingual-search/) but I am not sure how to achieve this with Laravel Scout . The only solution that comes in my mind is to

Laravel 5.3 date validator: equal to or after start_date

感情迁移 提交于 2019-12-09 07:48:15
问题 I'm using Laravel 5.3 to validate start_date and end_date for an event. end_date should be equal to start_date or the after date. end_date >= start_date $validator = Validator::make($data, [ 'start_date' => 'required|date', 'end_date' => 'required|date|after:start_date', ]); I tried to use after , but it only works for end_date > start_date. Of course, I can add custom rule using Validator::extend , but I'd like to know if we can do without adding custom rule. Is there any way to add negative

How to decrypt cookie?

对着背影说爱祢 提交于 2019-12-09 05:53:09
问题 I've just caught a crash reported on sentry, I am trying to debug and see the root cause for the problem. Luckily, in the cookies panel, I can see the laravel_session value that was used while crash happened. The question, is, how can decrypt the cookie? 回答1: You can decrypt the cookie with the following code: $cookie =

What happened to Laravel's redirectTo() method?

六月ゝ 毕业季﹏ 提交于 2019-12-09 05:14:21
问题 We can override this property to redirect users after login in LoginController: protected $redirectTo = '/home'; And here is the statement from documentation: If the redirect path needs custom generation logic you may define a redirectTo method instead of a redirectTo property: protected function redirectTo() { // } But it always redirects to '/home'; whatever the condition is. protected function redirectTo() { if (Auth::user()->role==0) { return '/volunteer'; } else { return '/donor'; } } If

Group by Laravel?

心不动则不痛 提交于 2019-12-08 19:46:27
I have the following query: $orders = Order::where(function ($query) use ($request) { // Filter by in process delivery if ($request->get("status") && $request->get("status") == "2") { $query->where('status', "2"); } })->groupBy('created_at')->get(); When I try to execute this query I get an error: SQLSTATE[42000]: Syntax error or access violation: 1055 'delivery.order.id' isn't in GROUP BY (SQL: select * from `order` group by `created_at`) What is problem? Amit Gupta In your config/database.php file, change mysql configuration array from 'strict' => true to 'strict' => false For more

HttpException in Handler.php line 133: This action is unauthorized

≯℡__Kan透↙ 提交于 2019-12-08 15:40:06
问题 I have created an application using laravel 5.3 and it is working fine on localhost but after I uploded all my code on a server I have this error: Symfony\Component\HttpKernel\Exception\HttpException in /home/project/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php line 133: This action is unauthorized. This is happening when I try to call functions whithin my controllers using post. This is one example: Route Route::group(['middleware' => 'auth'], function () { Route

Having a dynamic View folder path during runtime in laravel 5.3

江枫思渺然 提交于 2019-12-08 09:39:44
问题 I'm trying to build a saas application (saas here means software as a service) in laravel 5.3 . I've build few service provider which collects the domain name, the theme being used and databases of those particular website. Now I'm trying to implement the pages with view structure through service provider . Now for example I'm having two different themes for two different domains. I'm having the set of HTML code in views in different folders, something like this: View ----| Theme One --------

How to insert in Laravel?

♀尐吖头ヾ 提交于 2019-12-08 09:39:15
问题 I have output object $product after inserting data into table Product : $product = Product::create($data); In model Product I have: public function images() { return $this->hasMany("App\ProductImage"); } The I try to add images to table product_images : $product->images()->save(new ProductImage(UploadFiles::$files)); Relationship beetwen tables is product.id = product_images . So, after inserting I get message: General error: 1364 Field 'image' doesn't have a default value (SQL: insert into