laravel-4

Laravel 4 mandatory parameters error

五迷三道 提交于 2019-12-24 16:12:17
问题 Hello im working with laravel 4 in a proyect and it´s not the first time but i have a problem that ive never had before. Some mandatory parameters are missing ("key") to generate a URL for route "register". I dont know how to fix it i've tryed everything i came up with but no results. These are my routes: Route::get('register/{key}',array('before'=>'guest','as'=>'register','uses' => 'UserController@create')); Route::post('register/{key}',array('before'=>'csrf','uses'=>'UserController@store'))

Laravel 4 mandatory parameters error

▼魔方 西西 提交于 2019-12-24 16:02:28
问题 Hello im working with laravel 4 in a proyect and it´s not the first time but i have a problem that ive never had before. Some mandatory parameters are missing ("key") to generate a URL for route "register". I dont know how to fix it i've tryed everything i came up with but no results. These are my routes: Route::get('register/{key}',array('before'=>'guest','as'=>'register','uses' => 'UserController@create')); Route::post('register/{key}',array('before'=>'csrf','uses'=>'UserController@store'))

Best way of passing response information from Model to Controller using Laravel

戏子无情 提交于 2019-12-24 15:25:05
问题 The Model View Controller architecture tells me that all my business logic should be inside the Model , while the data flow should be handled by the Controller . Knowing this, while I'm dealing with my logic inside the Model , I need to let the Controller know if he's supposed to redirect to another url, redirect back, what kind of message or variable to pass during the redirection, etc. What is the best way of doing this? I can think of some ways, like throwing exceptions on the Model and

Generating an application key in Laravel 4

我只是一个虾纸丫 提交于 2019-12-24 15:20:07
问题 Has the php artisan key:generate command been removed in Laravel 4? Running it returns; [InvalidArgumentException] There are no commands defined in the "key" namespace. How should you generate keys now? Or do you need to create one manually? 回答1: At the time the question was asked, this feature had not yet been implemented for Laravel. It has now. This is one of the dangers of asking questions about software that's not yet been released. The answers will change. 来源: https://stackoverflow.com

Get location of view passed into laravel view composer

人盡茶涼 提交于 2019-12-24 15:08:48
问题 Is it possible to get the location of a view that is passed into a Laravel view composer? View::composer('*', function($view) { // I want to find out the location of the view file here // e.g. master.something.header // then add this to an array $loadedViews = View::share("loadedViews"); $loadedViews[] = $thisViewName; }); The reason is that I want to have a variable that will be shared between views and contain an array of all the views that are loaded. Any css and js files will be located

Paginate search result laravel

你说的曾经没有我的故事 提交于 2019-12-24 14:28:14
问题 After some help in a previous post Laravel - Search Facility on site using Eloquent I now need to some help on paginating the result using the built in laravel pagination class. public function search() //no parameter now { $q = Input::get('term'); if($q && $q != ''){ $searchTerms = explode(' ', $q); $query = DB::table('wc_program'); // it's DB::table(), not DB::tables if(!empty($searchTerms)){ foreach($searchTerms as $term) { $query->where('JobRef', 'LIKE', '%'. $term .'%'); } } $results =

Operation inside the view in the laravel

懵懂的女人 提交于 2019-12-24 14:20:17
问题 Here is my controller i am taking the blog details from the Blog model and passing it through BlogData Here is the controller $BlogData = Blog::where('BlogUrl', $data)->get(); return View::make('blogview')->with('BlogData', $BlogData); In the view @foreach ($Blogs as $Blog) {{ $Blog->BlogTitle }} {{ $Blog->BlogTag }} @endforeach The Question is i have the BlogTag coloumn as 1,3,4 which means it includes First, Second and Third Tag How can i fetch the Title of the Tag from the Tag Model Note :

preselect the select option using php

北战南征 提交于 2019-12-24 13:48:49
问题 I've a form to be completed to create a post . Now after creating that post, if I want to edit it, I'm showing a select option in the edit page something like below. (I am using Laravel) <select name="posts"> @foreach($posts as $post) <option value="{{$post->id}}"> {{$post->name }} </option> @endforeach </select> Now I need to preselect the populated select field with the current post name . I have a post id in the URL which I can get know in which post I am in. How can I select the right

Laravel … Automatically execute a script after few hours

喜夏-厌秋 提交于 2019-12-24 13:45:52
问题 Is it possible with laravel to logout a user automatically after few hours, say 10, even of the browser is closed and user doesn't log-out manually. 回答1: In app/config/session.php look for this code: /* |-------------------------------------------------------------------------- | Session Lifetime |-------------------------------------------------------------------------- | | Here you may specify the number of minutes that you wish the session | to be allowed to remain idle before it expires.

Using Flexbox with bootstrap 3 and laravel 4 blade templates and associated LESS mixin

戏子无情 提交于 2019-12-24 13:43:04
问题 I am trying to implement a flexbox solution to display an inline mailbox system for a site that is in development. The basic design I need to implement is displayed in the wireframe : The zone with the red border is where I need to implement the flexbox. As the development is done with Laravel Blade Tempting engine, we're using included files to generate the content of the three panes (left mailboxes, middle email list and right email viewer). The basic code structure is as follows: This