I switched my laravel app from 7.25 to 8.0. Now I am facing pagination problem.
{{ $download->links() }}
in controller
$download = Download::paginate(2);
Yes, it is working well but the UI is broken now.
image error ui
In Laravel 8 more options were added how pagination can be displayed.
This instruction https://laravel.com/docs/8.x/pagination#using-bootstrap should help.
Go to App\Providers\AppServiceProvider
add
public function boot() { Paginator::useBootstrap(); }
and import
use Illuminate\Pagination\Paginator;
Seems like they have made changes to the UI (bootstrap) in the latest, version.
I would suggest you to create a custom UI for that links by yourself. Use the following commands to publish the pagination views to resource directory and make some changes accordingly.
php artisan vendor:publish --tag=laravel-pagination
and points to your custom view with the following line of code:
{{ $paginator->links('view.name') }}
which is in your case {{$download->links('view.name')}}
After upgrade to 5.4 we have a problem with the Notifiy mailables, we embed the Application logo via
{{ $message->embed($path) }}
and it doesnt work anymore, i have a 5.3 copy where it works.. it looks like the $message variable is not injected automaticly anymore. we tried without the embedded image and the mailview is working.
Is there anything missing during our upgrade? i checked the upgradeguide twice.. we not using markdown.
Error:
Undefined variable: message (View: W:\project\resources\views\vendor\notifications\email.blade.php)
Codeexample:
User::find(1)->notify(
new EmailCredentialsTest(User::find(1))
);
Problem. When I follow an simple authentication tutorial for Laravel (v.5.2), and tries to register a new user I get the error: CSRF-token mismatch.
I am quite new to Laravel, and I am not sure how to proceed.
Background. I crated a new project for the tutorial, and runs it on my local machine (windows 10, on port 8000). I run it with Composer and artisan. My database are also on my local machine with XAMPP (on port 10080).
Code. https://github.com/isak-glans/laravel_problem
The tutorial:
https://www.youtube.com/watch?v=k89EOb9fqa0&list=PL_UnIDIwT95PiPV641VBnEwFAvswNZKuX&index=11
You need to add a cross site request forgery field to your form
<input type="hidden" name="_token" value="{{ csrf_token() }}">
or use the helper method:
{{ csrf_field() }}
This is used to prevent CSRF attacks.
Sorry didn't check your code first.
I cloned the app and registered without problems. I think that you are getting that error because the token expired.
Checkout this thread:
https://laracasts.com/discuss/channels/laravel/csrf-token-mismatch-error-on-session-timeout-form/
I am just starting out so please forgive me. I have a solid grasp on CodeIgniter, so I understand what is going on. However, I am noticing that my CSRF token is empty when I am creating a form. I am working through the laracasts videos to get a gasp on Laravel workflow.
myfile.blade.php
{!! Form::open((array('action' => 'MyController#method'))) !!}
...
{{!! Form::close() !!}}
Here is what I am getting when I view the source:
<form method="POST" action="http://mysite.dev/route" accept-charset="UTF-8">
<input name="_token" type="hidden">
</form>
I've looked through the config directory, but see nothing on having to enable csrf. Is there an additional setting somewhere I need to update?
Thank you for your suggestions.
EDIT
Even this gives me an empty hidden input field:
{{ Form::token() }} // <input name="_token" type="hidden">
EDIT
Here is what my controller looks like:
//use Illuminate\Http\Request;
use Request;
use App\Article;
use App\Http\Requests;
use App\Http\Controllers\Controller;
public function store(Request $request)
{
$input = Request::all();
return $input;
}
So my updated form tag looks like this:
{!! Form::open((array('action' => 'ArticleController#store'))) !!}
...
When I submit, I can see the json response - the token is obviously empty.
{"_token":"","title":"test","body":"test"}
The Laravel Fundamental series is for Laravel 5.0 so you have a few options. You can install Laravel 5.0 to continue with that series. In order to install L5.0, you need to run this command:
composer create-project laravel/laravel {directory} "~5.0.0" --prefer-dist
If you want to use Laravel 5.2 though (which I would recommend and Jeffrey Way will most likely release a series on this soon), there are several extra things to take into consideration.
First, put all your routes inside a "web" middleware group like this:
Route::group(['middleware' => ['web']], function () {
// Put your routes inside here
});
In the past, there were several middlewares that ran on every request by default. In 5.2, this is no longer the case. For example, the token is stored in the session, but in 5.2, things like the "StartSession" middleware are not automatically applied. As a result, the "web" middleware need to be applied to your routes. The reason for this change in 5.2:
Middleware groups allow you to group several route middleware under a single, convenient key, allowing you to assign several middleware to a route at once. For example, this can be useful when building a web UI and an API within the same application. You may group the session and CSRF routes into a web group, and perhaps the rate limiter in the api group.
Also, in the Laravel Fundamental series, Jeffrey pulls in the "illuminate/html" package, but now, most people use the laravel collective package. They handle a lot of the Laravel packages that are taken out of the core. As a result, I would remove the "illuminate/html" package. In your composer.json file, remove "illuminate/html: 5.0" (or whatever is in the require section). Also, remove the corresponding service provider and form facades that you added to your config/app.php file.
To install the laravel collective version, add this in your composer.json file instead: "laravelcollective/html": "5.2.*-dev". Then, run composer update. Once that's done, in your config/app.php file, add this to your providers array:
Collective\Html\HtmlServiceProvider::class,
and add this to your aliases array:
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
I hope I'm not missing anything else.
This is a config issue .You need to set the app key in your config file ...config/app.php to a 32 character string or use artisan cli php artisan key:generate to genearte the key for you to be able to use the CSRF token .
Also make sure that you include routes that use the CSRF token in the web group route .
You may exclude URIs by defining their routes outside of the web middleware group that is included in the default routes.php file, or by adding the URIs to the $except property of the VerifyCsrfToken middleware: http://laravel.com/docs/5.2/routing#csrf-protection
If you have a login page and you want to clear out the session using:
Session::flush();
Don't forget that this also cleans out the csrf token before it can be put in the view
It should be
{!! Form::open((array('action' => 'MyController#method'))) !!}
...
{!! Form::close() !!}
I have solved the issue of HtmlService provider actually 5.2 version removed Illuminate and add collective follow the step to solve the issue:
composer require laravelcollective/html
composer update
add in config/app.php
'providers' => ['Collective\Html\HtmlServiceProvider'],
'aliases' => [
'Form' => 'Collective\Html\FormFacade',
'Html' => 'Collective\Html\HtmlFacade',
],
Then you are able to use that form.
Hello i have some problem, i use Codeigniter Modular Extensions - HMVC.
Problem is when i try to show my module.
An Error Was Encountered
Unable to load the requested file: quicklinks_show.php
I have two modules
1.Dashboard
2.Quicklinks
The problem arises when I try to call and show another module in dashboard module.
I put this code in Dashboard/view/dashboard_view.php module
<div id="modules">
<?php modules::run('quicklinks/show');?>
</div>
In my Quicklinks modules i have simple Show() function
public function show(){
$this->load->view('quicklinks_show');
}
Make sure you have the view folder is named correct, so controller*s*, model*s* and view*s*
Try this pull request:
https://github.com/EllisLab/CodeIgniter/pull/1818
I tested that and it looks like this is the best hmvc solution.
Download here: https://github.com/dchill42/CodeIgniter/tree/hmvc_unit
It may be too late to reply but you may get the answer in this in-depth article of HMVC.