laravel-5.5

Job chaining in Lumen 5.5: withChain() not working how can I make it work?

浪子不回头ぞ 提交于 2019-12-24 11:51:42
问题 For dispatching a single job I usually do one of these: Queue::push(new ExampleJob); or dispatch(new ExampleJob); https://lumen.laravel.com/docs/5.5/queues According to the Laravel Docs a certain Job chain, where one Job depends upon the previous is done like this: ExampleJob::withChain([ new OptimizePodcast, new ReleasePodcast ])->dispatch(); https://laravel.com/docs/5.5/queues#job-chaining However this does not workin in Lumen (similar problem here: How to dispatch a Job to a specific queue

Laravel 5.5 application not booting anymore with “A facade root has not been set.”

泪湿孤枕 提交于 2019-12-24 10:56:57
问题 For some reason one of our applications isn't booting anymore. The stack trace looks like this: PHP Fatal error: Uncaught RuntimeException: A facade root has not been set. in /app/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:218 Stack trace: #0 /app/app/Exceptions/Handler.php(43): Illuminate\Support\Facades\Facade::__callStatic('get', Array) #1 /app/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(352): App\Exceptions\Handler->report(Object(Dotenv

Laravel redirect to correct path on missing routes

我只是一个虾纸丫 提交于 2019-12-24 08:59:36
问题 In my application when user enter this url as http://127.0.0.1:8000/showContent/aboutUs laravel show error as an Sorry, the page you are looking for could not be found. for that correct path is http://127.0.0.1:8000/en/showContent/aboutUs and I'm trying to manage that and adding missing segment for that for example: Route: Route::get('{lang?}/showContent/aboutUs', array('as' => 'lang', 'uses' => 'HomeController@showAboutUsPage'))->where('lang', '.+'); mapping routes: protected function

Laravel - find offset of record in mysql results

一曲冷凌霜 提交于 2019-12-24 08:48:32
问题 I have a MySQL table of records with several fields. These records are shown and updated live in the browser. They are displayed in an order choosen by the user, with optional filters also choosen by the user. Sometimes a change is made to one of the records, and it may affect the order for a given user. In order to position the message correctly in the list, I need to find where its new offset falls after the change to the record. Basically, I need to get the "id" for the record that now

SQLSTATE[HY000]: General error: 1364 Field 'photo' doesn't have a default value in laravel 5.5

為{幸葍}努か 提交于 2019-12-24 08:20:22
问题 I am trying to upload users photo during registration, but I am getting this error, I searched online and founded possible solutions did not work for me. I am using sentinel package for advanced authentication. Please anyone help me . Here is my controller- public function postRegister(Request $request){ $request->validate([ 'first_name' => 'required|max:255', 'last_name' => 'required|max:255', 'user_name' => 'unique:users|max:255', 'email' => 'required|unique:users|email|max:255', 'password'

Laravel, getting uploaded file's url

末鹿安然 提交于 2019-12-24 08:06:31
问题 I'm currently working on a Laravel 5.5 project, where I want to upload files , and then, I want to get their url back of the file (I have to use it client side). now my code looks like this: public function pdfUploader(Request $request) { Log::debug('pdfUploader is called. ' . $request); if ($request->hasFile('file') && $request->file('file')->isValid()) { $extension = $request->file->extension(); $fileName = 'tmp' . round(microtime(true) * 1000) . '.' . $extension; $path = $request->file-

Laravel - require php script in a service provider

隐身守侯 提交于 2019-12-24 07:49:54
问题 I am quite new to Laravel and implemented the service provider for my helper functions using this answer on SO. It recommended to: in the register function of your newly generated HelperServiceProvider.php add following code require_once app_path('Helpers/AnythingHelper.php'); However, Laravel docs state that register method should only be used to bind things into the container: As mentioned previously, within the register method, you should only bind things into the service container. You

Localization laravel

狂风中的少年 提交于 2019-12-24 05:16:05
问题 I have been trying to update language for the website. Controller public function getUpdateLanguage(Request $request) { $request_data = $request->all(); \Session::put('locale', $request_data['language']); return redirect()->back(); } Middleware: public function handle($request, Closure $next) { if ( \Session::has('locale')) { \App::setLocale(\Session::get('locale')); } return $next($request); } But the true block for if ( \Session::has('locale')) never executes and the language is always 'en'

Laravel : check if value is available on session or not

可紊 提交于 2019-12-24 05:11:13
问题 Just tired to find out how can i search the value from session.I just stored an id to the session.After that if same id requested, need to remove it from session, if id not available add it to the session. Here is my simple function that added id on session. public function addInquiry(Request $request) { Session::push('cart', $request->activity_id); return response()->json(Session::get('cart')); } What am getting on response ["1", "2", "3", "4", "1", "2"] How can i check that requested id is

Trying to get property of non-object in laravel 5.5

♀尐吖头ヾ 提交于 2019-12-24 02:57:50
问题 I am trying to show my variables values to view page, but it's showing the error of trying to get property of non-object. Please someone help me. Here is my Controller- public function myAffiliates(Request $request) { if ($user_id = Sentinel::getUser()->id) { $affiliates = DB::table('affiliate_users') ->where('affiliate_users.user_id', $user_id) ->first(); } //dd($affiliates); return view('dashboard.affiliates.show',['affiliates' => $affiliates]); } And I wrote to my view page like this-