laravel-5.3

Laravel 5 How to validate a unique customer name under each Activity when save

£可爱£侵袭症+ 提交于 2019-12-02 02:56:07
I had three model: Activity Model, Customer Model and Customeritem Model How to do the validation checking in store function whereby the customer name should be UNIQUE in each Activity? Below is each migration files Activity Model public function up() { Schema::create('activities', function (Blueprint $table) { $table->increments('id'); $table->string('activityName'); $table->string('activityCode'); $table->string('activityVenue'); $table->timestamps(); }); } Customer Model public function up() { Schema::create('customers', function (Blueprint $table) { $table->increments('id'); $table-

MethodNotAllowedHttpException in RouteCollection.php line 218:4

我只是一个虾纸丫 提交于 2019-12-02 01:42:53
问题 I will get MethodNotAllowedHttpException when submitting a form in laravel Html file <form method="POST" action="/cards/{{$card->id}}/notes"> <input name="_token" type="hidden" value="{{ csrf_token() }}"/> <textarea name="body" class="form-control"></textarea> <button type="submit">Add Note</button> </form> routes.php Route::post('cards/{card}/notes','NotesController@store'); NotesController.php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Http\Requests; class

Laravel flash or session messages not expiring [ not maintained Updated ]

六眼飞鱼酱① 提交于 2019-12-01 23:55:55
问题 Updated after some research After some research I conclude that, my sessions are not maintained until I save them explicitly, below code works well, but WHY???? Ref here Session::put('lets_test', 2); Session::save(); Old Question I'm new to laravel 5.3, and stuck at a problem. My Laravel Session or Flash messages are not expiring they display each time page is reloaded, until I use Session::flush() Below is my controller code <?php namespace App\Http\Controllers; use Session; use Auth; use

Laravel global middleware can't get session

天涯浪子 提交于 2019-12-01 19:15:30
protected $middleware = [ \App\Http\Middleware\Syspoint::class, ] use Session; class Syspoint { echo \Session::get('syspoint'); } I have a middleware required run everytime when page request, the middleware contain session. I place inside of protected $middleware , but global middleware not able to get session. You are calling Session but it is not already started. If you need Session inside your middleware you have to put it in the property protected $middlewareGroups under the key web and after the call to StartSession, i.e.: protected $middlewareGroups 'web' => [ \App\Http\Middleware

Is it possible to change props value from method in Vue component?

断了今生、忘了曾经 提交于 2019-12-01 15:23:31
I have a component and i am passing value 543 to props :prop-room-selected, <navigation-form :prop-room-selected='543'> </navigation-form> Now, From a button click, i am calling the function updateCoachStatus to change the value of propRoomSelected, but the props value is not updating. { template: '#navigation-form', props: ['propRoomSelected'], data: function () { return { roomSelected: this.propRoomSelected, } }, methods:{ updateCoachStatus: function(event){ this.propRoomSelected = 67; } } } I dont know how to change the value of props from function. Is it possible in Vue to update the value

Is it possible to change props value from method in Vue component?

自作多情 提交于 2019-12-01 14:16:54
问题 I have a component and i am passing value 543 to props :prop-room-selected, <navigation-form :prop-room-selected='543'> </navigation-form> Now, From a button click, i am calling the function updateCoachStatus to change the value of propRoomSelected, but the props value is not updating. { template: '#navigation-form', props: ['propRoomSelected'], data: function () { return { roomSelected: this.propRoomSelected, } }, methods:{ updateCoachStatus: function(event){ this.propRoomSelected = 67; } }

Laravel 5.3: How to use Auth in Service Provider?

こ雲淡風輕ζ 提交于 2019-12-01 12:47:12
I am passing a value in shared view by taking value from table. I need to know user ID for the purpose but Auth::check() returns false. How do I do it? Below is code: public function boot() { $basket_count = 0; if (Auth::check()) { //always false $loggedin_user_id = Auth::user()->id; $basket_count = Cart::getBasketCount(); } view()->share('basket_count', $basket_count); } OK turns out that ServiceProviders are not place for such things. The best thing is a Middleware . So if you want to call Auth, create middleware and pass value to views. public function handle($request, Closure $next) {

Laravel- Dompdf Maximum execution time of 60 seconds exceeded

北城以北 提交于 2019-12-01 09:39:08
问题 Here is error when i convert pdf, it's not working since i run my laravel project by " php artisan serve --port=1000 ". But if i run my laravel project with xampp. it's alright. I don't know why?. Give me explaination and repairs . Thank you Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_UNKNOWN) Maximum execution time of 60 seconds exceeded 回答1: Increase Your time limit in your controller file.Below variable to increase your time limit. set_time_limit(300); 回答2: The laravel

Laravel change Connection for Notifications table

断了今生、忘了曾经 提交于 2019-12-01 09:23:08
I am implementing Laravel 5.3 Notifications at the moment which is working very nice. At the moment I am using 'email' as a notifications channel but I want to add 'database' too. I am using different databases/connections for languages and want to store the notifications in a central database / Connection. How do I use a different database connection for notifications? I already tried creating a Notifications model but that did not work: namespace App; use Illuminate\Database\Eloquent\Model; class Notifications extends Model { protected $connection = 'system'; } Hackish solution. But tried

laravel passport custom password column

走远了吗. 提交于 2019-12-01 06:54:44
How can I use Laravel's Passport package to authenticate a different password column. If i want to authenticate from a different 'username' column, it can be done with the following code: public function findForPassport($username) { return $this->where('id', $username)->first(); } It will take Id, as the column. What if I want to use a different 'password' column. A column in the table with a different name such as 'uid_token'. There's a method the Passport/Bridge asks for called validateForPassportPasswordGrant($password) that you can override in your user model, if you don't override this it