#### Category : laravel-8

I created an artisan command using this command: php artisan make:command –command=custom:command SomeCustomCommand After I ran the command it created the file below: <?php namespace AppConsoleCommands; use IlluminateConsoleCommand; class SomeCustomCommand extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = ‘custom:command’; /** * The .. Read more Hello I’m trying to learn laravel, and I got to the point where I stumbled upon this problem in templating where the content is not showing up when using @yeild it only shows the content of the main blade file and does not display the @section in the child here is my code below, what .. Read more I want to test how an API endpoint behaves for different users. I create three users with their corresponding JWT tokens and access the endpoint accordingly. The first one works flawlessly but the two following requests just act as if they were done by the first user. The tokens are definitely the ones for the .. Read more I try to do decrypt value ? But it is giving this error. The payload is invalid. use IlluminateSupportFacadesCrypt; use IlluminateContractsEncryptionDecryptException;$identity_no = "eyJpdiI6Inhzakt4SE10Mk1TbGVNakZKb29nc2c9PSIsInZhbHVlIjoiaW9tWGVhOXZaQWlCYzhBbmNrbTV3dXdQYmNrTmt1S3dHKzdqelNLcFppbVJoR2s3NmptaVlKaU4rc1NSU3F2MW1oSVlJdU9OTEJuT05w ▶"; $decrypted_identityno = Crypt::decryptString($identity_no); dd($decrypted_identityno); die(); Sourc.. Read more When I start seeding my database with db:seed, I got this error: Call to a member function count() on null at P:<folderName><folderName>srcvendorlaravelframeworksrcIlluminateDatabaseEloquentFactoriesHasFactory.php:18 14▕ { 15▕$factory = static::newFactory() ?: Factory::factoryForModel(get_called_class()); 16▕ 17▕ return $factory ➜ 18▕ ->count(is_numeric($parameters[0] ?? null) ? $parameters[0] : null) 19▕ ->state(is_array($parameters[0] ?? null) ? $parameters[0] : ($parameters[1] ?? [])); 20▕ } ..

Read more

I get the following error when performing the following command php artisan route: list I updated the RouteServiceProvider.php file. I am looking for the route admin.edit that does not detect it May be is the wipe of a controller and create a new one, but I think that i did it correcly. $this->routes(function () { .. Read more I want to add a session of warning like this at my Controller method: return view(‘panel.step3’ , compact(‘factor’ , ‘showStep’) )->with(‘warning’ , ‘test !’); And then on view panel.step3, I have added this: @dd(session(‘warning’)) But it says: NULL So what is going wrong here ? How can I properly add my session ? I would .. Read more I’m using Laravel Sanctum to allow users to generate personal access tokens (like GitHub). I’ve created a form where users can create a new personal access token submitting a name and some abilities. I would like to validate the name field to ensure that’s unique. public function rules(): array { return [ ‘name’ => [‘required’, .. Read more I have a radio group that filters my table to show whether items are active, inactive or both. There is also a button that I am using to export an excel document of the table. My current button downloads all the records. What I want is to export the document based on the filter so .. Read more I want to show uploaded pictures of users at my Blade, so I added this: @foreach($users as $user) @if($user->photo_id) <td class="center"> <img src="{{ $user->photos->path }}" width="80"> </td> @else <td class="center"> </td> @endif @endforeach But it returns this error: Exception Property [path] does not exist on this collection instance. I have already added these relationships to .. Read more I am creating a controller that saves photos to the /storage/ folder. To protect myself from submitting a bunch of large photos and not to style their CSS, I wanted to resize them using the Intervention / image library. Unfortunately, despite following the installation instructions directly from the documentation, several uninstallations and reinstallations of the .. Read more There is a mail company that our company works with, we have to send all mails in the system via the API provided by this company, but they do not have any libraries. In the document they sent, they added all their api requests in the form of cURL. I think after this step, when .. Read more I am trying to create an online Resume Maker using PHP laravel authentication with Breeze. I am using a shared hosting with limited number of inode usage quota of 10k. Now the problem with Laravel is that upon uploading to the shared hosting it is consuming 90% of the inode usage quota with its bulk .. Read more I’ve installed Laravel 8 on my Linux Mint 20 for my projects and I’ve searching many source how to use stored procedure in Laravel with user input parameters which one of sources is : How to execute Stored Procedure from Laravel But when i tried to add data from tambah_transaksisupplier.blade.php it appeared like this : .. Read more I am fetching data from database then i am adding one more attribute to that data. for that i am using map() in this function in am using$qty variable which has 5 value let say. then i am reducing its value in next iteration but unfortunately that’s not happening $qty =$request->product_qty; $searchProducts->map(function ($product) ..

Read more

I have PurchaseOrderProduct Model from which I am getting data like that PurchaseOrderProduct::with(‘products’)->with(‘warehouse_locations’)->with(‘productStatuses’)->with(‘purchase_orders’)->where(‘product_id’, $request->product_id)->where(‘free_qty’, ‘>=’, 1)->get(); Now in this table, I have the column expiry_date of type date i want to fetch data orderBy expiry_date nearest to the current date . Means purchase_order_product whose expiry date is nearest to current date should come first. Source: .. Read more I am trying to create a form submit but I bumped to a unexpected scenario. When form submitted by clicking the submit button The web app reroute to my index page of the resource route With the form variable and values appended in the URL. Example URL before submitting: http://127.0.0.1/admin/products/create URL after submitted: http://127.0.0.1/admin/products?_token=qQ4klvK2egdsP77iMY4RQhXd5laJDUONRyuh8oQd&productTitle=&productPrice= View .. Read more I am getting Consignment model which belongsTo Product type model so when i try to access name of product type i use this query$consignment->product_types->name But checked that this queries mean select* from product_types In my projectti am using this method many places which is now creating issue. Is there any method i can just ..

Read more

I have driver’s has many relation with run_sheets and runsheet can hasMany relation with consignments Driver model public function run_sheets() { return $this->hasMany(‘AppModelsAdminRunSheet’,’driver_id’); } runsheet model public function consignments() { return$this->hasMany(‘AppModelsAdminConsignment’, ‘runsheet_id’)->orderBy(‘delivery_address’); } so in order to take count of conisgnments i have to use loops which increase the number of queries and page ..

Read more

I am adding a textarea to my blade template and populating it with a read-only list of items server-side. This is what I got: <div class="form-group"> <textarea class="form-control" rows="10" readonly> @foreach($items as$item) {{trim($item)}} @endforeach </textarea> </div> My problem is it is not displaying correctly, I get lots of whitespace before each line. so it .. Read more My doubts about the factories and the seeds. I try to do the migrations with the seeds and I get the following issue. Call to undefined method DatabaseFactoriesPostFactory::faker() I not have very clear where to make the call, if in a separate file, such as PostSeeds or how I am doing it here. This is .. Read more Hye, I want to get dropdown selected data. For your information, my dropdown data is from my database. I already retrieve data from database and put it inside my dropdown. Right now, I want my validation. If user key in all information and forgot to key in 1 column data, the dropdown part should get .. Read more I am new to Laravel and I am making a new project where I am exporting my schools data to a spreadsheet with maatwebsite, I have given it a title with the following code: public function headings(): array { return [ [‘Staff Report’], [ ‘staffid’, ‘name’, ’emailaddress’, ‘faculty’, ] ]; } What I want to .. Read more i have a question regarding why do we need to set protected$model = User::class when defining a Factory and in the model itself we need sometimes (if we did not use a convention for Factory name ) to override newFactory method to tell the model about the Factory ? why we need both of ..

Read more

How it is possible that I change the address bar location to show nothing and it still redirects the page using laravel 8 and bootstrap. As My webpage have sections to which i want to redirect from another page and my address bar is currently like and it should be like Sourc..

Read more