laravel-5.2

Laravel 5.2 : Web middleware is applied twice

感情迁移 提交于 2019-12-17 21:23:15
问题 Here is my routes.php code Route::auth(); Route::group(['middleware' => 'web'], function () { Route::group(['namespace' => 'Admin', 'prefix' => 'admin', 'middleware' => ['auth','role:Admin']], function(){ Route::get('/home', 'HomeController@index'); Route::get('user/data', ['as' => 'admin.user.data','uses'=>'UserController@userData']); Route::resource('user', 'UserController'); Route::get('merchant/data', ['as' => 'admin.merchant.data','uses'=>'MerchantController@merchantData']); Route:

How to use Laravel's hasManyThrough across 4 tables

烂漫一生 提交于 2019-12-17 19:46:21
问题 I have 4 tables with a structure and flow like this: User Accounts Contacts Orders The relationship is as follows: $user->hasMany('accounts')->hasMany('contacts')->hasMany('orders'); /** User Model **/ class User extend Eloquent { public function accounts(){ return $this->hasMany('Accounts'); } public function contacts(){ return $this->hasManyThrough('Contact', 'Account', 'owner_id'); } //how do I get this? public function orders(){ } } /** Account Model */ class Account extends Eloquent {

Laravel Store Array in Session

﹥>﹥吖頭↗ 提交于 2019-12-17 19:38:57
问题 I have been having trouble storing an array in session. I am making a shopping cart and it doesn't seem to work. public function __construct(){ $product = array(1,2,3,4); Session::push('cart', $product); } and then retrieve it in the view like this. {{Session::get('cart')}} However I keep getting an error like this. htmlentities() expects parameter 1 to be string, array given Any clues and advice on how to create a shopping cart that stores an array of items. 回答1: If you need to use the array

laravel 5 : Class 'input' not found

半世苍凉 提交于 2019-12-17 17:25:28
问题 In my routes.php file I have : Route::get('/', function () { return view('login'); }); Route::get('/index', function(){ return view('index'); }); Route::get('/register', function(){ return view('register'); }); Route::post('/register',function(){ $user = new \App\User; $user->username = input::get('username'); $user->email = input::get('email'); $user->password = Hash::make(input::get('username')); $user->designation = input::get('designation'); $user->save(); }); I have a form for users

I'm getting error “Class 'Predis\Client' not found” in Laravel 5.2

情到浓时终转凉″ 提交于 2019-12-17 16:00:19
问题 I want to using Redis in laravel 5.2 however, I'm getting error such a Class 'Predis\Client' not found, How I can solve it. 回答1: First download the REDIS to your system (if you haven't already installed it). Go to the folder where you have downloaded the redis and run this command: cd your-redis-folder-name make Go to your project directory and install composer: composer require predis/predis Go to your .env file and add Queue driver: QUEUE_DRIVER=redis use Mail::queue() to send mail via

Uncaught ReflectionException: Class log does not exist Laravel 5.2

时光怂恿深爱的人放手 提交于 2019-12-17 06:07:19
问题 I am currently trying to clone an existing project of mine from github. After clone I run composer install during the process I receive the following error: Uncaught ReflectionException: Class log does not exist I am running Laravel 5.2 on Centos 7. I have seen references to: Removing spaces within the .env file. Removing the vendor directory & re-installing Removing certain packages required in composer.json I have: Replaced my .env with the example.env to avoid any custom config errors. I

Uncaught ReflectionException: Class log does not exist Laravel 5.2

夙愿已清 提交于 2019-12-17 06:07:00
问题 I am currently trying to clone an existing project of mine from github. After clone I run composer install during the process I receive the following error: Uncaught ReflectionException: Class log does not exist I am running Laravel 5.2 on Centos 7. I have seen references to: Removing spaces within the .env file. Removing the vendor directory & re-installing Removing certain packages required in composer.json I have: Replaced my .env with the example.env to avoid any custom config errors. I

CKEditor doesn't show in laravel 5

二次信任 提交于 2019-12-14 04:11:51
问题 I want to save some data from a webpage and for that i wanted to use CKEditor in my page. But after loading the page it's showing normal textarea instead of showing CKEditor . i followed the following process to use it: 1 Download the ckeditor.zip file, uncompressed it and placed it in public > js folder 2.then in my master page in HEAD tag i have used the following line to link it: <script type="text/javascript" src="{{ URL::asset('assets/js/ckeditor/ckeditor.js') }}"></script`> 3 after that

UrlGenerationException (Missing required parameters for [Route])

萝らか妹 提交于 2019-12-14 03:56:22
问题 I don't know where this error came from it says. I got this error when I tried to update my records. It works properly and updating into my database but getting this error. It says that that missed something in my parameter. I think my error is return redirect()->route('account.show'); when I tried to redirect to my show view after updating. But when I redirect to other works fine. Any opinions? Missing required parameters for [Route: account.show] [URI: show/{id}]. I have 3 blade template.

Ajax delete not working in laravel 5.2

十年热恋 提交于 2019-12-14 03:26:31
问题 I'm trying to delete a record in mysql in laravel application. But it shows TokenMismatchException error. I am not able to find why its throwing error. It would be great if anyone can help out.. here's view code: (I don't have a form) <a href="{{url('/page/'.$Ids->id)}}" class="remove-entry"> <button type="button" class="close" aria-label="Close"><span aria-hidden="true">×</span></button> </a> And here's jQuery AJAX call : $(document).on('click', '.remove-entry', function(e){ e.preventDefault