blade

Displaying the Error Messages in Laravel after being Redirected from controller

别等时光非礼了梦想. 提交于 2019-12-18 11:02:13
问题 How can I display the validation message in the view that is being redirected in Laravel ? Here is my function in a Controller public function registeruser() { $firstname = Input::get('firstname'); $lastname = Input::get('lastname'); $data = Input::except(array('_token')) ; $rule = array( 'firstname' => 'required', 'lastname' => 'required', ) ; $validator = Validator::make($data,$rule); if ($validator->fails()) { $messages = $validator->messages(); return Redirect::to('/')->with('message',

Passing multiple parameters to controller in Laravel 5

做~自己de王妃 提交于 2019-12-18 03:12:52
问题 In my application, a user has the ability to remind another user about an event invitation. To do that, I need to pass both the IDs of the event, and of the user to be invited. In my route file, I have: Route::get('events/{id}/remind', [ 'as' => 'remindHelper', 'uses' => 'EventsController@remindHelper']); In my view, I have: {!!link_to_route('remindHelper', 'Remind User', $parameters = array($eventid = $event->id, $userid = $invitee->id) )!!} In my controller, I have: public function

Passing multiple parameters to controller in Laravel 5

耗尽温柔 提交于 2019-12-18 03:12:00
问题 In my application, a user has the ability to remind another user about an event invitation. To do that, I need to pass both the IDs of the event, and of the user to be invited. In my route file, I have: Route::get('events/{id}/remind', [ 'as' => 'remindHelper', 'uses' => 'EventsController@remindHelper']); In my view, I have: {!!link_to_route('remindHelper', 'Remind User', $parameters = array($eventid = $event->id, $userid = $invitee->id) )!!} In my controller, I have: public function

Laravel 5 - Add a stylesheet only if on a certain page/controller (page specific asset)

吃可爱长大的小学妹 提交于 2019-12-17 18:20:13
问题 My Laravel layout is currently as follows (removed navbar etc..): <link href="//maxcdn.bootstrapcdn.com/bootswatch/3.3.4/flatly/bootstrap.min.css" rel="stylesheet"> <link href="{{ asset('/css/app.css') }}" rel="stylesheet"> <!-- Fonts --> <link href='//fonts.googleapis.com/css?family=Roboto:400,300' rel='stylesheet' type='text/css'> <!-- Scripts --> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <!-- HTML5 shim and Respond.js for IE8 support of HTML5

Blade view not reflecting changes

落爺英雄遲暮 提交于 2019-12-17 18:15:54
问题 I am developing a Laravel(5.2.29) project in Windows environment and testing it on Chrome browser. I have made some changes on a Blade file using atom text editor and then refreshed my page and noticed that suddenly it has stopped reflecting the changes (it's loading the old Blade file). I've tried the following: Restarted the browser Clearing browser cache Running php artisan cache:clear Running composer dumpautoload Deleting the Blade file (and got a view not found error). Then created a

The align of the laravel not properly cause by multiple embedded css and external css in one blade file

风流意气都作罢 提交于 2019-12-14 03:59:30
问题 I am using laravel as my framework, i am facing the problem which is i @extends a php into another php, it works fine. But i not sure why the layout will become strange when the page is loading finish. This is my code @extends('layouts.cal') <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Laravel</title> <!-- Fonts --> <link href="https://cdnjs

laravel how to specifiy the input columns

余生长醉 提交于 2019-12-14 03:12:06
问题 I have a form in html that has an input with name restaurantName , but my column in the database is name . I am not able to use this in the controller Restaurant::create(Input::only('restaurantName')); Because there is no column with restaurantName so my question is how to tell laravel that restaurantName is maped to name ? many thanks Edit the html form has these fields: restaurantName website username password mobileNumber firstName lastName The database has two tables which are Admin and

laravel loop over collection

北城余情 提交于 2019-12-14 02:36:00
问题 I have this code: $data = new Restaurant(array('id' => $restaurant_id)); $data = $data->waitingtimes(); foreach($data as $oneTime){ echo $oneTime->value; } exit; as you see, I tried to print the value attribute for each $data , but I got empty results. However, when I do this: $data = new Restaurant(array('id' => $restaurant_id)); $data = $data->waitingtimes(); echo $data->first()->value; exit; I get results, so the $data absolutely has values in it. I tried to read the basecollection class

Is this Blade sanitation working correctly (double vs triple curly braces)?

╄→гoц情女王★ 提交于 2019-12-14 00:51:41
问题 I apologize that this is most likely a misunderstanding of my own, rather than there being an actual problem. I'm fairly new to Laravel and Blade templating, and I'm trying to output a few fields taken from an Input::get . When I output the fields via double and triple curly braces, however, there doesn't seem to be a difference between the output. Here is an excerpt of my View: @ $data = Input::only('name', 'date'); {{ "Unfiltered input: ".$data['name'] }} <br /> {{{ "Filtered input: ".$data

laravel how to update a field to a database

瘦欲@ 提交于 2019-12-13 20:46:19
问题 This is my code $admin = Admin::find(25); $admin->picture = $destination; $admin->save(); but when I execute it, the picture field is keep NULL for example images/admin_20 the destination is a string to the location of the image. I already tried ->update() but also nothing becomes saved. could you help me please Edit 1 the picture column in my database is varchar(255) utf8_unicode_ci 回答1: Try this: $admin = Admin::where('id', '=', 25); $admin->picture = $destination; $admin->save(); You didn