laravel-5.2

Auto Complete with Laravel 5.2

徘徊边缘 提交于 2019-12-11 10:45:14
问题 I already have a functional search box form my website, but i want to implement a auto complete functionality for my search bar. I know there are a bunch of plugins like typeahead, and etc. I would like to implement typeahead or the jQuery Autocomplete widget, if you guys know how. I seen some tutorials, but they don't work for the code i have. I will show you the blade, controller and route that I have for my search box. How can I load all my data from my database into the source field in

ManyToMany relation - how update attribute in pivot table

心已入冬 提交于 2019-12-11 10:24:24
问题 I am now learning to work with pivot tables: https://laravel.com/docs/4.2/eloquent#working-with-pivot-tables I have WeeklyRoutine model. Each routine has several Activities. The assigned activities are attached in a pivot table activity_routine . Relation defined in the WeeklyRoutine model: return $this->belongsToMany('App\Models\Activity', 'activity_routine', 'routine_id', 'activity_id')->withPivot('done_at')->withTimestamps(); } it looks like this: // activity_routine pivot table (relevant

Laravel 5.2 Mongo MonogDB Failed to parse MongoDB URI

时间秒杀一切 提交于 2019-12-11 08:28:20
问题 I am getting this error: MongoDB\Driver\Exception\InvalidArgumentException: Failed to parse MongoDB URI: 'mongodb://mongo:tcp://172.17.0.3:27017/mydatabase' in /var/www/laravel/vendor/mongodb/mongodb/src/Client.php:81 My enviroment variables look like this: MONGO_DATABASE="mydatabase" MONGO_HOST="mongo" MONGO_PASSWORD="" MONGO_PORT="27017" MONGO_USERNAME="" and my database.php looks like this 'mongodb' => [ 'driver' => 'mongodb', 'host' => env('MONGO_HOST', 'localhost'), 'port' => env('MONGO

Laravel- Multiauth is not working in Laravel 5.2

吃可爱长大的小学妹 提交于 2019-12-11 08:04:18
问题 I am trying to implement multi authentication in laravel 5.2 . I am following this article My Auth.php <?php return [ 'multi' => array( 'user' => array( 'driver' => 'eloquent', 'model' => 'App\User', 'table' => 'users', ), 'admin' => array( 'driver' => 'database', 'model' => 'App\Admin', 'table' => 'tbl_admin_user', ) ), 'password' => [ 'email' => 'emails.password', 'table' => 'password_resets', 'expire' => 60, ], ]; My App.php 'providers' => [ /* * Laravel Framework Service Providers... */ /

Auth::login($user) in laravel not able to login the user

♀尐吖头ヾ 提交于 2019-12-11 07:17:29
问题 I am using laravel 5.4 and Auth::login($user) is showing Type error: Argument 1 passed to Illuminate\Auth\SessionGuard::login() must implement interface Illuminate\Contracts\Auth\Authenticatable, instance of Illuminate\Database\Eloquent\Builder given, called in /home/vendor/laravel/framework/src/Illuminate/Auth/AuthManager.php on line 294 My User.php file is: namespace App; use Illuminate\Notifications\Notifiable; use Illuminate\Foundation\Auth\User as Authenticatable; class User extends

Validating 'other' field only if dropdown value is 'other'

不想你离开。 提交于 2019-12-11 06:39:22
问题 Slightly complicated one to explain, but a very common use case. I have this field on my page: <select class="form-control" name="how_you_heard_about_us" id="select-hearaboutus"> All of the options within it have names, including this one: <option value="Other">Other</option> I also have a text input, which is only required if the user selects 'Other'. Here's my condensed validation code: $this->validate($request, [ 'first_name' => 'required|max:20', 'last_name' => 'required|max:20', 'how_you

PHP Trait Override Protected Trait Method

青春壹個敷衍的年華 提交于 2019-12-11 06:35:32
问题 I am having problems with a composer package I am dealing with. It implements a trait Billable. trait Billable { /** * Update the payment method token for all of the user's subscriptions. * * @param string $token * @return void */ protected function updateSubscriptionsToPaymentMethod($token) { foreach ($this->subscriptions as $subscription) { if ($subscription->active()) { BraintreeSubscription::update($subscription->braintree_id, [ 'paymentMethodToken' => $token, ]); } } } } I am trying to

Run config clear on browser

你。 提交于 2019-12-11 06:15:32
问题 I need to run php artisan config:clear on my app that is online, the only issue is that I have only the FTP credentials and DB, and not the SSH to run on the terminal, how can I run this command without the terminal? Already tried looking on the forum and didn't found any question related with my issue but didn't found any answer for it. 回答1: You can call the artisan command from anywhere in your PHP code block. $exitCode = Artisan::call('config:clear'); More info can be found here https:/

Call to undefined method Route::name()

百般思念 提交于 2019-12-11 05:42:44
问题 im trying to set a name for my route Route::get('test/show/{id}' , 'TestController@show'); accourding to documentation Instead of specifying the route name in the route array definition, you may chain the name method onto the end of the route definition: Route::get('user/profile','UserController@showProfile')->name('profile'); so i wrote Route::get('test/show/{id}' , 'TestController@show')->name('testShow'); but i get FatalErrorException in routes.php line 28: Call to undefined method

Return logic from Controller into View Laravel 5

守給你的承諾、 提交于 2019-12-11 05:42:41
问题 I have tables: REGIONS id | name ----+------------------ 1 | South Luzon ----+------------------ 2 | North West Luzon ----+------------------ 3 | North East Luzon ===================================== BRANCHES machinenum | name | region_id -----------+-----------+----------- 108 | Alaminos | 1 -----------+-----------+----------- 104 | Alexander | 3 -----------+-----------+----------- 131 | Santiago | 3 -----------+-----------+----------- 114 | Apalit | 1 -----------+-----------+-----------