Category : laravel

i tried insert ads using validation system but its give me error Argument 1 passed to IlluminateValidationFactory::make() must be of the type array, object given, called in D:wampwwwpaginationvendorlaravelframeworksrcIlluminateSupportFacadesFacade.php on line 261 AdsController.php public function store(Request $request) { $file = new File($request->all()); $file->user_id = Auth::user()->id; $validator = Validator::make($file->all(), [ ‘category_id’=>[‘bail’,’required’], ‘titre’ => [‘bail’, ‘exclude_unless:category_id,1’, ‘required’, ‘string’, ..

Read more

I am creating a movie series database and have models like so: Series $with=["seasons"] hasMany(AppSeasons) Season $with=["episodes"] belongsTo(AppSeries) hasMany(AppEpisode) Episode belongsTo(AppSeason) Question 1 How can I based on Eloquest Series::all() sort desc by Episode ID ? [ [… seasons: [ [… episodes: [ [id] <—- sort by this ] ] ] ] Question 2 Can ..

Read more

My app is multi languages and I have a validation in Livewire component as follows: $this->validate([ ‘name’ => ‘required|string|max:200’, ‘desc’ => ‘required|string|max:2000’, ],[],[ ‘name’ => trans(‘site.name’), ‘desc’ => trans(‘site.descrption’), ]); I need to translate the attributes of input by trans function With above code I got this error: ErrorException mb_strtoupper() expects parameter 1 to be ..

Read more

Currently building a web application with Laravel but have a strange bug which I can’t seem to find a solution to. The url: http://localhost/posts/acd572e873d22c29b4dbc20f18a3e4dd Loads the page correctly however the url http://localhost/checkouts/acd572e873d22c29b4dbc20f18a3e4dd/ redirects to http://localhost/AppName/public/checkouts/acd572e873d22c29b4dbc20f18a3e4dd Not a clue what I have changed or done to have this happen. My current .htaccess in my htdocs looks ..

Read more

with spatie/medialibrary package i have 3 conversions in registerMediaConversions method like this public function registerMediaConversions(Media $media = null): void { $this->addMediaConversion(‘thumb’) ->fit(MANIPULATIONS::FIT_STRETCH, 140, 260); $this->addMediaConversion(‘slider’) ->fit(MANIPULATIONS::FIT_STRETCH, 275, 720); $this->addMediaConversion(‘mini’) ->fit(MANIPULATIONS::FIT_STRETCH, 55, 85); } the thing i want is that i can define a useFallbackUrl image for each of these conversions. i know i can define ..

Read more

I designed a permission system to my laravel application, but i have a doubts about design controllers, i can make a one controller to manage role, module and relations, or the best method is create a single controller to each model? Structure: table permission (role,module relation) table permission_role table permission_module (route/controller it can be accessed) ..

Read more

I have my Laravel auth.php setup with multiple providers and multiple guards. ‘guards’ => [ ‘web’ => [ ‘driver’ => ‘session’, ‘provider’ => ‘users’, ], ‘account’ => [ ‘driver’ => ‘session’, ‘provider’ => ‘accounts’, ], ], ‘providers’ => [ ‘users’ => [ ‘driver’ => ‘eloquent’, ‘model’ => AppModelsUser::class, ], ‘accounts’ => [ ‘driver’ => ‘eloquent’, ..

Read more

Basically I’m using the @entangle to share the state between my Livewire component and my Alpine component. <div x-data="{ open:@entangle(‘showModal’) }" @keydown.escape="showModal=false"> <button type="button" class="block p-2 btn-light-green" @click="showModal=true">AƱadir Mezcla</button> <!–Overlay–> <div class="overflow-auto" style="background-color: rgba(0,0,0,0.5)" x-show="showModal" :class="{ ‘absolute inset-0 z-10 flex items-center justify-center’: showModal }"> <!–Dialog–> <div class="bg-white w-11/12 md:max-w-md mx-auto rounded shadow-lg py-4 text-left px-6" ..

Read more

i am getting a "Trying to get property ‘nama_posisi’ of non-object (View: D:noupiyantoSKRIPSI NOUPIspk2SAW2resourcesviewscalonformcalon.blade.php)" error in Laravel when I try assessing a data from Calon model in my view. it used to work with well before but suddenly this error appear today CalonController.php <?php namespace AppHttpControllers; use IlluminateHttpRequest; use AppCalon; class CalonController extends Controller { ..

Read more

I have a ubuntu server that runs a stack of docker-compose that includes nginx as the http-server exposing port 8081 and on the host the apache2 is redirecting site.com requests to site.local:8081. The laravel app for example redirects to site.local:8081/home after login, instead I want it to redirect to site.com/home. And I don’t know exactly ..

Read more

I can’t see errors when i try the named error bag. Can someone help me? Thanks. (Laravel 8) Controller $request->validateWithBag(‘contactform’, [ ‘name’ => ‘required’, ’email’ => ‘required|email’, ‘subject’ => ‘required’, ‘message’ => ‘required’, ]); View @if($errors->any()) <div class="uk-alert uk-alert-danger"> <a class="uk-alert-close" uk-close></a> <h3 class="uk-text-light">There was an error while sending contact form.</h3> @foreach($errors->contactform->all() as $error) <p>&mdash; ..

Read more

Helloo, my friends. I reviewed all tutorials on multiauth (without using is_admin) with different tables for different levels of authorization. I have two authorization entities: boss and admin (Manager and admin) However, unlike all these tutorials: I don’t have a separate authorization page. The authorization window is located on the main page and appears when ..

Read more

I have a project in Laravel which has model names, fields and messages in Spanish, I am currently using laravel-shift/blueprint to generate all the base code of the application from a yaml file, at the moment of Laravel infer the pluralization of the names for the migrations, controllers, variables etc, it makes them treating the ..

Read more

I already got my route:list (output shown below): But when I try to call via postman, it seems that it doesn’t work: Sorry if this is a dumb question but it was previously working on Laravel 7 but now not working on 8. I’m hoping someone can help me through this. Thanks. Sourc..

Read more

I’ve got part of code which I want to be executed if IF condition is satisfied then only once, for that certain situation, otherwise it should be executed over and over again while WHILE condition is satisfied. public function sampleFunc($action = null) { $action_process = function() { return SomeTable::where(‘condition’, ‘test’)->first(); }; while (!empty($action = $action_process())) ..

Read more

I’m trying to deploy my first Laravel app on Heroku. I’ve followed this tutorial. I’ve also setup all the environment variables. But still I’m getting View not found. I have already ran: php artisan config:clear && php artisan clear:cache && php artisan optimize:clear Is there any option to solve this problem? How can I manage ..

Read more

I’m using cURL to make a post request to printify API, here is my code but i’m getting errors here is my code $url = ‘https://phpstack-012.cloudwaysapps.com/’.$file_url[1]; $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.printify.com/v1/uploads/images.json", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", ..

Read more

I upload my laravel project from localhost to server but to access the app my url is http://myhostexample.com/public/ I want it to be http://myhostexample.com I have modified the public/.htaccess and here it is : <IfModule mod_rewrite.c> <IfModule mod_negotiation.c> Options -MultiViews -Indexes </IfModule> RewriteEngine On # Handle Authorization Header RewriteCond %{HTTP:Authorization} . RewriteRule .* – [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] ..

Read more