Questions tagged as 'laravel'

2
answers

Default Input Value in Laravel

In%%, I want, when a given value does not exist in Laravel , I can set a default value. With pure PHP, you can do this: $text = isset($_POST['text']) ? $_POST['text'] : 'padrão'; In Laravel I know it's possible to do something like...
asked by 15.03.2016 / 16:47
2
answers

Travers arrays with dates and compare to the current date

I need to create a method that compares two or more arrays if the current date is greater than the due date (date_paymentX) that exists in those arrays and returns how many occurrences there are. Method: public function payments() { $da...
asked by 09.08.2017 / 17:41
1
answer

General error: 1215 Can not add foreign key constraint

I'm trying to add a foreign key to this table with the following code block public function up() { Schema::create('registros', function (Blueprint $table) { $table->increments('id'); $table->integer( 'cliente' )-&g...
asked by 23.11.2017 / 20:53
2
answers

Laravel, call Action from a Controller from a View?

I have a View where in it I would like to add the link of a Controller with its Action specifies and when loading this View to Action of that Controller is triggered. Example: within a View I...
asked by 27.06.2017 / 07:01
2
answers

Laravel: View and SubViews

Does anyone know how my layouts.default can load multiple views every time they are called. For example I want to call the views of the menus and the menu.blade.php file has to receive data as well.     
asked by 28.06.2014 / 06:01
1
answer

Should I feed my site through the API or not?

If I'm developing a site that has an integrated API, for example, Laravel, I have a website and an API in the same project What is the best way to feed the site? Should I create a controller that will fetch the API information in JSON and...
asked by 12.06.2018 / 18:13
2
answers

How to globally set the default date output in Laravel 5?

I remember well when I used Laravel 4 that it was possible to globally convert the formats of created_at and updated_at , to display in JSON responses or even to the {{ $model->created_at }} direct call. I did the follo...
asked by 14.03.2017 / 17:09
2
answers

Laravel - Session and Array

I need to create an array: array( 0 => 0, 1 => 0, 2 => 1, 3 => 0, 4 => 0, 5 => 1, 6 => 0) within a session: session('session_array') and then individually add and retrieve the values according...
asked by 13.05.2016 / 17:15
2
answers

How to compress the output of an HTML in Laravel?

I answered this question here once about the subject: Store PHP script output in HTML "compacted" . But now I would like to know how I can do this in Laravel. When it comes to an HTML response, how could I capture all the rendering of...
asked by 14.09.2016 / 19:08
1
answer

How to use laravel paginate with a manual query?

I have a manual query in my model, and I want to return to view of blade the result of this query with pagination. Is there any way?    Model class Ticket extends Model { protected $fillable = [ 'id',...
asked by 06.09.2016 / 21:09