Category : laravel

I am trying to connect private email with my Laravel project. .env configuration below MAIL_DRIVER=smtp MAIL_HOST=mail.privateemail.com MAIL_PORT=587 [email protected] MAIL_PASSWORD=myPrivateEmailPassword MAIL_ENCRYPTION=tls [email protected] MAIL_FROM_NAME=MyCustomName After this , I run this three command, php artisan config:clear php artisan config:cache php artisan queue:restart I have too many EmailJob files to send emails. That’s why I used the last command. ..

Read more

I am trying to store the last run time of a scheduled job in Laravel. However, the cache is not updating the date. I want the cache to be remembered until the function is called again. public function getLastRun() { Cache::forget(‘last_automation_api_run’); Cache::rememberForever(‘last_automation_api_run’, function () { return now()->toDateTimeString(); }); } Sourc..

Read more

I m new to laravel and making a search app for homeo remedies i am facing following problem $remAilProps = DB::table(‘remedies’) ->join(‘ailment_modules’, ‘remedies.id’, ‘=’, ‘ailment_modules.rem_id’) ->join(‘ailments’, ‘ailment_modules.ail_id’,’=’,’ailments.id’) ->join(‘ailment_modules as ail’,’ailments.id’,’=’,’ail.ail_id’) ->join(‘ailment_props’,’ail.ail_id’,’=’,’ailment_props.ail_id’) ->join(‘props’,’ailment_props.props_id’,’=’,’props.id’) ->join(‘props_values’,’props.id’,’=’,’props_values.props_id’) ->select(‘ailment’,’props’,’propsValue’) ->distinct() ->groupBy(‘propsValue’) ->keyBy(‘ailment’) ->where(‘remedies.id’,’=’,$id) ->get(); return view(‘layout.navitems.users’) ->with(‘ailment’,Ailments::all()) ->with(‘rem’,Remedy::where(‘id’,’=’,$id)->firstOrFail()) ->with(‘org’,Organs::all()) ->with(‘remedy’,Remedy::all()) ->with(‘remAilProps’, $remAilProps); } when i loop it blade view the ..

Read more

I’m new to webpack and trying to add a custom icon font builder to a Laravel project. The iconfont library is available at iconfont-webpack-plugin, and added to webpack.config.js as follows: const IconfontWebpackPlugin = require(‘iconfont-webpack-plugin’); module: { rules: [ { test: /.css$/, use: [ ‘css-loader’, { loader: ‘postcss-loader’, postcssOptions: (loader) => { return { plugins: [ ..

Read more

there is a form with a select field "state", the value of which must be "draft" or "published". how to do it? does not work now. $this->validate($request, [ ‘name’ => ‘required|unique:article_categories’ . $category->id, ‘description’ => ‘required|min:200’, ‘state’ => ‘draft’ || ‘published’ ]); Sourc..

Read more

Why when I create a model from a seeder I get the error(IlluminateDatabaseQueryException): SQLSTATE[23502]: Not null violation: 7 ERROR: null value in column "id" violates not-null constraint DETAIL: Failing row contains (null, aaa, aaaa, null, aaaa, null, 2021-04-14 13:18:16, 2021-04-14 13:18:16). (SQL: insert into "users" ("id", "name", "email", "password", "updated_at", "created_at") values (?, aaa, aaaa, ..

Read more

I having trouble to build a query to filter out all products with collumn hidden == false, the logic is if the attribute hidden is ticked it will not select these ‘hidden’ row. Here my code: $products = DB::table(‘view_product’) ->join(‘brand’, ‘view_product.brand_id’, ‘=’, ‘brand.id’) ->join(‘category’, ‘view_product.category_id’, ‘=’, ‘category.id’) ->select(‘view_product.*’, ‘brand.name as brand_name’,’category.name as category_name’) ->orwhere("brand.name", "LIKE", ..

Read more

if (!Cache::store(‘file’)->has(‘channel’)) { $products = Channel::select(‘*’); Cache::store(‘redis’)->put(‘channel’, $products, 86400); } $products = Cache::store(‘redis’)->get(‘channel’, []); return DataTables::eloquent($products) ->addIndexColumn() ->make(true); This throws me "Serialization of ‘PDO’ is not allowed", if i am trying if (!Cache::store(‘file’)->has(‘channel’)) { $products = Channel::select(‘*’)->get(); Cache::store(‘redis’)->put(‘channel’, $products, 86400); } $products = Cache::store(‘redis’)->get(‘channel’, []); return DataTables::eloquent($products) ->addIndexColumn() ->make(true); then datatables throws error of Method ..

Read more

In Laravel 8 I have PageController with seven classes: index, create, store, show, edit, update and destroy. In routes I have something like this: Route::get(‘/dashboard/pages’, [PageController::class, ‘index’])->name(‘pages’)->middleware(‘auth’); Route::resource(‘pages’, PageController::class); But I need "show" class to be public. How can I do this, is that possible? index, create, store, edit, show, update and destroy -> This ..

Read more

I realized that laravel/eloquent does not save my model when I change a column with an object cast like this: $original = ‘{"test": null}’; $new = ‘{"test": false}’; The reason is that attributes that are casted as an object are evaluated like this (to find out if the record is dirty) in HasAttributes.php::R1577: } elseif ..

Read more

I know how I can decide this problem – MaxConnection, BUT I need in another solution, because I guess, this is not right, therefore I want to find a library which does it. Because I think, later I will get the error again. So is it possible to find which library creates a lot of ..

Read more