laravel-4

Composer hangs on “Resolving dependencies through SAT” on 4.2

你离开我真会死。 提交于 2020-01-02 01:05:12
问题 Things I've tried: Removing everything except for Laravel (version 4.2.*) - This completes but still hangs for around 5 minutes Updating composer Removing /vendor Doing clean Laravel 4.2 install (hangs around 3 minutes) Doing clean Laravel 5 install (doesn't hang at all) Turning off xdebug completely (doesn't seem to make a difference) With all my packages, I've seen composer complete but only when I left it running overnight. I can't deploy to forge at all because it times out! This only

Laravel convert an array to a model

做~自己de王妃 提交于 2020-01-02 00:43:24
问题 i have an array as follows 'topic' => array ( 'id' => 13, 'title' => 'Macros', 'content' => '<p>Macros. This is the updated content.</p> ', 'created_at' => '2014-02-28 18:36:55', 'updated_at' => '2014-05-14 16:42:14', 'category_id' => '5', 'tags' => 'tags', 'referUrl' => '', 'user_id' => 3, 'videoUrl' => '', 'useDefaultVideoOverlay' => 'true', 'positive' => 0, 'negative' => 1, 'context' => 'macros', 'viewcount' => 60, 'deleted_at' => NULL, ) I would like to use this array and convert/cast it

Remove HTML tags from Strings on laravel blade

白昼怎懂夜的黑 提交于 2020-01-01 23:12:27
问题 I want remove HTML tags (all) from a string on laravel blade ... code {!! \Illuminate\Support\Str::words($subject->body, 5,'...') !!} output (example) <p>hassen zouari</p> I want that it be like this hassen zouari 回答1: Try to use strip_tags() function: http://php.net/manual/en/function.strip-tags.php Update: Try to do something like this in a controller: $taglessBody = strip_tags($subject->body); Then pass this variable into a blade template and use it instead of $subject->body . 回答2: You can

Remove HTML tags from Strings on laravel blade

谁说我不能喝 提交于 2020-01-01 23:12:12
问题 I want remove HTML tags (all) from a string on laravel blade ... code {!! \Illuminate\Support\Str::words($subject->body, 5,'...') !!} output (example) <p>hassen zouari</p> I want that it be like this hassen zouari 回答1: Try to use strip_tags() function: http://php.net/manual/en/function.strip-tags.php Update: Try to do something like this in a controller: $taglessBody = strip_tags($subject->body); Then pass this variable into a blade template and use it instead of $subject->body . 回答2: You can

Laravel - Send Variable to layout master and keep it during session

元气小坏坏 提交于 2020-01-01 19:36:55
问题 I am wondering if there are any way in laravel to send a variable to the layout master and keep it there while the user is logged in. I know how I can do it, like this $this->layout->with('catalog.categories', $data); But the problem of this is that I will have to be sending the variable on all the controllers and through all the class. And to get the variable I will need seven or eight lines of code on top of that. I will give you an easy example. Imagine I have a messenger center in my web.

Laravel - Send Variable to layout master and keep it during session

守給你的承諾、 提交于 2020-01-01 19:36:08
问题 I am wondering if there are any way in laravel to send a variable to the layout master and keep it there while the user is logged in. I know how I can do it, like this $this->layout->with('catalog.categories', $data); But the problem of this is that I will have to be sending the variable on all the controllers and through all the class. And to get the variable I will need seven or eight lines of code on top of that. I will give you an easy example. Imagine I have a messenger center in my web.

How to use condition for one to many relationship in Laravel

馋奶兔 提交于 2020-01-01 17:52:07
问题 I am using Laravel 4.2 I have the following models: User and Booking (booking has user_id that references User model in id) I want to make a query to retrieve Bookings where bookings.starts_at > now I want something like this: User::with('bookings')->where('starts_at' , '>' time())->get(); but where condition is applied on User and hence it causes an exception because User does not have starts_at. How to solve this issue while still using Eloquent class? Thanks 回答1: This in controller: Load

How to use condition for one to many relationship in Laravel

吃可爱长大的小学妹 提交于 2020-01-01 17:50:14
问题 I am using Laravel 4.2 I have the following models: User and Booking (booking has user_id that references User model in id) I want to make a query to retrieve Bookings where bookings.starts_at > now I want something like this: User::with('bookings')->where('starts_at' , '>' time())->get(); but where condition is applied on User and hence it causes an exception because User does not have starts_at. How to solve this issue while still using Eloquent class? Thanks 回答1: This in controller: Load

How to use localization in Blade tag templates?

依然范特西╮ 提交于 2020-01-01 12:33:12
问题 1st question: I've inserted the localization in many types of texts and things, but I don't know how to import it into in the following forms: {{ Form::label('name', 'here') }} {{ Form::text('name', null, array('placeholder' => 'here')) }} {{ Form::submit('here', array('class' => 'btn btn-success')) }} {{ Form::button('here', array('class' => 'btn btn-default')) }} I want it to be in the form label 'here' and in the placeholder of the text 'here'. 2nd question: I am not allowed to insert it

Laravel 4 bypass maintenance mode for a route

☆樱花仙子☆ 提交于 2020-01-01 11:59:26
问题 I have put my application down for maintenance using php artisan down command. My custom maintenance page as a email input to accept the email from the user and store in my database to notify the user when the site is back up and running again. But when I submit the form using POST, I get redirected to the maintenance mode page. I want one particular route to bypass the maintenance mode. Is it possible? 回答1: Okay so I found a way to go about this problem. In my app/routes file, I have a route