laravel-5.2

Pass value from one view to other laravel routes configuration

丶灬走出姿态 提交于 2019-12-23 03:12:42
问题 I have just started using laravel and currently using the version 5.2. I am using two forms to get the data. First form in first view and second form in second view. I need to figure out a way to tell the second form, the form id of the first one, which the second form will be linked to. I know this can be done by passing the values using the URL. But I lack the knowledge of the correct syntax. 1- How to send data while redirecting? 2- How should the route look like? 3- How to access that

Laravel sql search json type column

南笙酒味 提交于 2019-12-23 02:43:16
问题 The mysql has table 'subscribe' table and it's as follows: column type id int condition json type_id id and the example as follows: "id": "1", "condition": "{\"id\":\"2\",\"class\":\"master\",\"zone\":\"west\",\"price\":\"511\"}", "type_id": "1" and I want to select the column which match in the column condition like "zone"="west" the laravel 5.2 has support the order $subscribe = DB::table('subscribe')->where('condition->class', 'master')->get(); Error Column not found: 1054 Unknown column

Laravel 5.2 routes with web midellware

岁酱吖の 提交于 2019-12-23 01:01:57
问题 I have a problem with [Route::group(['middleware' => ['web']], function () {}); ] when I use it in the routes file it shows this error: FatalErrorException in Container.php line 702: Maximum function nesting level of '100' reached, aborting! my routes.php is : use App\Discussion; Route::group(['middleware' => ['web']], function () { Route::get('/', function () { return view('welcome'); }); Route::auth(); }); Route::get('home', function () { $discussion = Discussion::orderBy('created_at', 'asc

Registration error in Laravel

只愿长相守 提交于 2019-12-23 00:31:18
问题 I use the default auth/registration in Laravel 5.3. When I try to register new user I get error: FatalThrowableError in RegistersUsers.php line 33: Call to undefined method Illuminate\Auth\TokenGuard::login() I have made some changes in configuration Laravel: 'defaults' => [ 'guard' => 'api', 'passwords' => 'users', ], So, by default I use api guard 回答1: The authentication driver api you are trying to use is TokenBased. That means the server will issue your client a Token on successful

Laravel - how to pass a parameter to a route? Is there a better practice?

一个人想着一个人 提交于 2019-12-22 14:08:13
问题 The simplified scenario is the following: I have a few pages in the database (ideally not more than 10-20, but there is no hard limit). They all have some content and a "slug" (there are slugs that contain a forward slash, if that matters). I'm trying to register route(s) to these slugs to a PageController that displays the content of the given page. Here are my ideas about the approach: Register a single "catch 'em all" route (which should be the very last registered route). This is

set a default value for select field in Laravel using collective form builder?

旧时模样 提交于 2019-12-22 14:02:07
问题 I have a select field in my form for selecting admin roles.I need to set a default value for that select field like 'Select Role'.I am using Laravel 5.2 and collective form builder class.here is my code {!! Form::select('role_id',App\Role::orderBy('name')->lists('label','id'),$roleId,array('class'=>'form-control col-md-7 col-xs-12','id'=>'role_id')) !!} 回答1: Third argument is a default for select list, so $roleId should contain default role ID in this case. If it doesn't work, you should

Laravel 5.2 Authentication - How can I show logged in user's name and the logout link in every page?

谁都会走 提交于 2019-12-22 11:17:02
问题 Laravel 5.2 Authentication I created a new authentication scaffolding in Laravel 5.2 using php artisan make:auth everything worked perfectly except I get Login/Register links even after logging in when I'm in route / but it shows the user's name with a logout link (which is what I want to have in every page) when I'm in route /home How can I show logged in user's name and the logout link in every page? 回答1: This is because, you are not using the auth middleware on you / route. In your routes

How To Get Search Query From Multiple Columns in Database

假装没事ソ 提交于 2019-12-22 10:59:03
问题 I have search form to get information from table named books. Right now i'm using this controller public function search(Request $request) { $keyword = $request->input('keyword'); $query = Book::where('judul', 'LIKE', '%' . $keyword . '%'); $book_list = $query->paginate(5); $pagination = $book_list->appends($request->except('page')); $total_book = $book_list->total(); return view('dashboards.index', compact('book_list', 'keyword', 'pagination', 'total_book')); } The problem is the data that i

Laravel 5.2 Login not working

若如初见. 提交于 2019-12-22 10:10:53
问题 I have created a new Laravel 5.2 installation. And I have run the following command to install the default Laravel authentication; php artisan make:auth The registration form works but the login just redirects home without logging in. And displays no errors when when I enter the wrong credentials. This is my routes file: Route::get('/', 'BaseController@index'); Route::get('/tutors', 'TutorsController@Index'); Route::get('/tutors/myrequest', 'TutorsController@RequestTutor'); Route::get('

Understanding Queues and Scheduler on Laravel 5.2

喜欢而已 提交于 2019-12-22 10:04:23
问题 I am experimenting on how to write jobs on Laravel. Following the Laravel documentation, I created a simple job that sends email using mail:queue. I also added a cron job that will call the scheduler every minute which in turn will run the job every 5 minutes. Everything works fine when I manually run the command queue:listen. Later I added a print statement inside the scheduler and I found a strange issue. Whenever I run the queue:listen from the terminal, I see the print message that is