laravel-5.2

Troubleshooting referencing a model in a laravel controller

南楼画角 提交于 2019-12-12 02:32:15
问题 I've been trying unsuccessfully to resolve an error in a laravel 5.2 app (carfreak). FatalErrorException in PropertyController.php line 85: Class 'App\Models\CarModel' not found I have moved the default user model to a folder app/models and made the necessary changes so that it's all working fine. Now I have a new controller CarController , and a new model, CarModel that are just not working. It seems to be such a simple problem with namespaces, but I am unable to resolve it. is the model in

Laravel 5.2 - Updated and Route group Middleware now is no longer called

早过忘川 提交于 2019-12-12 02:28:16
问题 So I was on the latest Laravel 5.1 and updated to 5.2 today. In my routes I have something like this: Route::group(['middleware' => ['api']], function() { // Members Route::get('members', '{api-namespace}\MembersController@index'); Route::get('member/{id}', '{api-namespace}\MembersController@show'); // Members Pension Route::get('member/{id}/pension/beneficiaries', '{api-namespace}\Inquiry\MembersPensionController@showBeneficiaries'); Route::get('member/{id}/pension/contributions', '{api

Get data in select-box dropdown when editing form - Laravel 5.2

旧街凉风 提交于 2019-12-12 02:26:50
问题 How would I keep my data in my select box when going back and editing a product? Here is my form with parent and sub-categories: <form role="form" method="POST" action="{{ route('admin.product.update', $product->id) }}"> {{ csrf_field() }} <div class="col-xs-12 col-sm-6 col-md-6"> <div class="form-group{{ $errors->has('category') ? ' has-error' : '' }}"> <label>Parent Category</label> <select class="form-control" name="category" id="category" data-url="{{ url('api/dropdown')}}"> <option value

TokenMismatchException in VerifyCsrfToken.php Laravel 5.2

一个人想着一个人 提交于 2019-12-12 02:25:24
问题 I have got the dreaded VerifyCsrfToken error in my Laravel 5.2 project. Relevant codes are below: Route which is throwing the error Route::group(['middleware' => ['web']], function(){ Route::resource('register', 'RegisterController'); }); Error is thrown when I try to register a new user using POST request Register Controller public function store(Request $request) { return AppUser::create([ 'name' => $request->input('name'), 'email' => $request->input('name'), 'contact_number' => $request-

Pretty urls not working laravel 5.2 on a https protocol

余生长醉 提交于 2019-12-12 02:22:23
问题 Pretty urls was working on when it was on "http" using this tutorial (https://laravel.io/forum/09-15-2015-removing-indexphp-from-url-laravel-5116) i figured it out but as i configured the "https" it stopped working (Not Found The requested URL /login was not found on this server. Apache/2.4.7 (Ubuntu) Server at wasamar.com.ng Port 443) , what did i do wrong? by the way i am using an ubuntu cloud server 14.04 This is my virtual host config /etc/apache2/sites-avalable/wasamar.com.ng.conf

How to clear a session variable once the user logout in laravel 5.2 auth system

时光总嘲笑我的痴心妄想 提交于 2019-12-12 02:07:48
问题 I am using laravel 5.2 auth system to manage users but i have to delete a specific session variable after user logged out from the site. but i dont know where to place the session destroy function to achieve this. 回答1: Use Session::flush(); to delete all variable And Session::forget('key'); for particular key. Use any of these after Logout and before you redirect to some page which could look like as below public function getLogout() { auth()->logout(); return redirect()->route('index'); } 来源

Laravel 5.2 Auth Registration page blocked

偶尔善良 提交于 2019-12-12 01:56:23
问题 I'm currently making a webapp with laravel. I'm using the build-in laravel authentication system, and added ranks myself. However, when you are logged in, you can't reach the registration page. THe thing here is, I want only admins to be able to create new users. My routes: Route::group(['middleware' => ['web']], function () { Route::get('login', ['as' => 'auth.login', 'uses' => 'Auth\AuthController@showLoginForm']); Route::post('login', ['as' => 'auth.login', 'uses' => 'Auth\AuthController

How do I make a referral program in Laravel?

你。 提交于 2019-12-12 01:37:53
问题 I am trying to create a program where other users can sign up using links of other already registered users. So, when one is referred, this is how the url would look like mywebsite.com/register?ref_id=555 // ref_id is existing user id I am using the default Laravel auth. There is a hidden input value which would contain the value of ref_id if it exists. My database has a column called referred_by which is an INT and set to null by default. When someone registers using the link with ref_id,

Laravel 5.2 route model binding

◇◆丶佛笑我妖孽 提交于 2019-12-11 23:35:26
问题 Laravel has a documentation regarding route model binding which could be found here. But there is no example with regards to this kind of scenario: Route::get('search/', 'ArticleController@search'); How to I implicitly bind a model into the route? I know I could do something like this directly on the controller's method. public function search(Model $model) { // some code here } But I'm just curious on how to do it on the routes instead. I am after this approach Route::get('search/{article}',

return view is returning different data

淺唱寂寞╮ 提交于 2019-12-11 20:39:29
问题 everybody, My code here is returning tasks that have more than 1 Tag and task tags are in $TagArray everything is working good in return $TaskData; but When I pass TaskData into view I get different results even get Tasks with one tag return view ('task', compact('TaskData')); My Code $TaskData= Path::with(['pathtags' => function ($q) use ($TagArray) { $q->with(['Tasks' => function($q) use ($TagArray) { $q->has('tasktags', '=' , 2)->whereDoesntHave('tasktags', function ($query) use ($TagArray