المشاركات

عرض المشاركات من أغسطس, ٢٠٢١

request again the method in the controller in Laravel 5.8 from the handler

I'm adding a global handler in Handler.php. I need to kind of reload the page without having for the user to redo the whole operation. from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3iN5xcL via IFTTT

Laravel Auth logout not working -- Before posted Answer for this question are not working in my case

I have developed small application for Auth learning purpose where everything works fine Login Logout and Dashboard page. But Case1 once after clicking on logout, try to access dashboard page by editing url in browser it goes to dashboard page which is wrong. Case2 when i cleare cache and browsing data and try to access dashboard it works fine and redirect for login which is correct. I am using Auth::logout for logged out Following is my code web.php Route::get('/', function () { return view('welcome'); }); Route::get('/login','AuthenticationController@login')->name('login'); Route::post('/login.submit','AuthenticationController@getLogIn')-> name('login.submit'); Route::get('/register','AuthenticationController@register')->name('register'); Route::post('/register.submit','AuthenticationController@addUser')-> name('register.submit'); Route::get('/logout&#

Eloquent has() method counts soft deleted rows

using $users = User::has('comments','>=',3); in Laravel 5.6 returns users with more than 3 comments but counts soft deleted comments, while I want the list of users who have more than 3 active comments. from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3m5FvUc via IFTTT

Undefined variabel : shop view at foreach list item shop

Here this is the error Here this is the error ==== cart.blade.php I'm confused to make the page go directly to the shopping list. the error here says the shop variable is not defined in the loop to display items that have been added to the cart. but the data is already entered into the database <div class="container"> <div class="row mb-5"> <form class="col-md-12" method="post"> <div class="site-blocks-table"> <table class="table table-bordered"> <thead> <tr> <th class="product-thumbnail">Image</th> <th class="product-name">Product</th> <th class="product-price">Price</th> <th class="product-quantity">Quant

Error with composer update does not comply with psr-4 autoloading standard. Skipping

I have this error when i run composer update Class MercadoPago\AdvancedPayments\AdvancedPayment located in C:/xampp/htdocs/vendor/mercadopago/dx-php/src/MercadoPago\Entities\AdvancedPayments\AdvancedPayment.php does not comply with psr-4 autoloading standard. Skipping. how is it solved? from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3AGj2kM via IFTTT

Array Merge with condition

Array 1: [ { "product_name": "Redme note 7" "quantity": "548.00" "purchase_price": "10000.00" "product_id": 1 } { "product_name": "Redme note 7" "quantity": "150.00" "purchase_price": "19000.00" "product_id": 1 } { "product_name": "Fresh Water 5 Litre" "quantity": "20.00" "purchase_price": "70.00" "product_id": 2 } { "product_name": "Fresh Water 5 Litre" "quantity": "348.00" "purchase_price": "80.00" "product_id": 2 } { "product_name": "Fresh Water 5 Litre" "quantity": "1067.00&qu

Php artisan schedule:run only once execute command in localhost

I created a command artisan to make a text file in my path. This command executes correctly by running the command but not for task scheduling in my localhost (not server). CreateFile class : protected $signature = 'create:file'; public function handle() { $myfile = fopen("newfile.txt", "w") or die("Unable to open file!"); $txt = "parisa"; fwrite($myfile, $txt); fclose($myfile); } Kernel.php : protected $commands = [ Commands\CreateFile::class, ]; protected function schedule(Schedule $schedule) { $schedule->command('create:file')->everyMinute(); } When I run php artisan schedule:run my command executes only once at that moment. But I want to execute every minute. How to fix it? from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2VPMiXg via IFTTT

laravel, displaying data on a dropdown from another table but saving in current table

I have 2 tables, a user table and a working_hours table. on the Add screen for working_hours I want a drop down to allow a user to pick an ID from the users table and when the submit button is pressed, it will store in my working_hours table under the worker_id column. Controller: public function store(Request $request) { $energy = new Work; $energy->staff_id = $request->input('staff_id'); $energy->work_time = $request->input('work_time'); $energy->save(); return redirect('/vmaintenance')->with('success', 'data added'); } Model: class Work extends Model { public $timestamps = false; protected $table = 'work_log'; protected $primaryKey = 'id'; protected $dates = ['date']; protected $guarded = ['id']; use HasFactory; } dropdown list: <div> <label>Select Staff</label> <select name="staff_id"

Get data from 2 tables with a join

I have these 2 tables : keyword and keyword_translated keyword id name keyword_translated id translation keyword_id I want to get all keyword , doesn't matter has or not relation with keyword_translated . At the end I want to get something like : [ [ keyword_id => 1, keyword_name => 'firstKeyword' keyword_translated_id => 1, // if exist relation between `keyword` and `keyword_translated` keyword_translated_translation => 'This is translation of firstKeyword' // if exist relation between `keyword` and `keyword_translated` ], [ keyword_id => 2, keyword_name => 'secondKeyword' keyword_translated_id => null, // if didn't exist relation between `keyword` and `keyword_translated` keyword_translated_translation => null // if didn't exist relation between `keyword` and `keyword_translated` ], ] I tried like this : $keywords = DB::table('keywords') ->join('

Pdf not opening properly generated with dom pdf

صورة
I'm generating pdf using dom pdf. Code : $dompdf = new Dompdf(); $pdfData=Data::where('id',auth()->user()->id)->first(); $html = view('admin/view-data/',['pdfData'=>$pdfData])->render(); $dompdf->loadHtml($html); $dompdf->setPaper('A4', 'portrait'); $dompdf->render(); $fileName = 'filenaname.pdf'; Storage::put('public/pdf'.$fileName, $dompdf->output()); pdf is being generated in the storage/app/public/pdf/ folder i'm downloading it using vue.js : Link: <a href="#" class="btn btn-xs btn-success" title="Downaload" @click="downloadIt('/storage/'+user.user_id)"><i class="fa fa-file-pdf" aria-hidden="true"></i></a> Method: downloadIt(url) { var str = url.split("/"); var filename = str[str.length - 1]; axios.get(url, {responseType: 'blob'}) .then((response) => { const url

Can you call data from a column in one table to be used in another table in SQL and Laravel?

I have a staff table that contains the details of staff members and there is another table called maintenance where the time they worked needs to be added. I have an empty combo box and I would like to populate that box with the staff from the staff table so that when a selection is made and the hours they worked is entered and the submit button is clicked, it will save as a record in the maintenance table here is my combo box code: <div> <label>Select technician</label> <select name="technician" > <option value="">--Select--</option> <option value="Old"></option> <option value="New"></option> </select> </div> here is my model: class Maintenance extends Model { public $timestamps = false; protected $table='maintentance_table'; protected $primaryKey = 'id'; protected $dates = ['date']; use HasFactory; } and in my co

Laravel 5.0 Class not found

I have a class called "Language" on my project im working on which lets you choose a language the page is on and determines which language is currently chosen. I was updating my laravel and ran into a problem on the 5.0 update that it no longer finds my Language class. I think it is an autoloader issue but i am not 100% sure about it. This is my file order Language.php is the class that cant be found and the file that cant find it is home.php under "resources\views\home.php" This is my Language.php file <?php namespace App\Libaries; use Illuminate\Support\Facades\Facade; class Language extends Facade { private static $primary; private static $secondary; protected static function getFacadeAccessor() { return 'Language'; } public static function init() { if (strlen(Request::segment(1)) === 2) { self::$primary = Request::segment(1); } elseif (strlen(Request::segment(1)) !== 2) { self::$primary = &#

npm run dev error for npx mix in bootstrap for laravel

I installed bootstrap 5 and also installed the dependency required @popperjs/core but still after doing that it still brought out for me from the ./nodemodules. I would appreciate any assistance on how to clear this error ERROR in ./resources/css/app.css Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js): ModuleBuildError: Module build failed (from ./node_modules/css-loader/dist/cjs.js): Error: Can't resolve '~bootstrap/css/bootstrap' in 'C:\Sites\firstProject\resources\css' at finishWithoutResolve (C:\Sites\firstProject\node_modules\enhanced-resolve\lib\Resolver.js:293:18) at C:\Sites\firstProject\node_modules\enhanced-resolve\lib\Resolver.js:362:15 at C:\Sites\firstProject\node_modules\enhanced-resolve\lib\Resolver.js:410:5 at eval (eval at create (C:\Sites\firstProject\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:16:1) at C:\Sites\firstProject\node_modules\enhanced-resolve\lib\Resolver.js

how to display 15 product from category having multiple subcategories in random order in laravel?

صورة
I have 3 tables: homepage order- integer status - boolean product_category_id - integer category name- string slug- slug parent_id- integer product name- string category_id- integer When user wish to have categories in homepage like this I want to have 15 products from categories in homepage including products from subcategories in random order. So far what i have done is // all categories to be posted in homepage. $hp_categories = HomepageCategory::asc()->active()->get(); foreach ($hp_categories as $hp_cat) { // array declaration $cat_with_subcat_arr = []; // category $product_category = ProductCategory::where('id', $hp_cat->product_category_id)->first(); // push category's id to array array_push($cat_with_subcat_arr, $product_category->id); // subcategories if any. $product_category->childrenCategori

Attempt to read property "doc" on null

I have a candidat , and document Models but when I use $candidat->document->doc I get Attempt to read property "doc" on null Document Model : class Document extends Model { use HasFactory; protected $table = 'documents'; protected $fillable = [ 'id_candidat', 'doc', 'date_depot']; public function candidat() { return $this->belongsTo(candidat::class, 'candidat_id'); } } Candidat Model : class candidat extends Model { use HasFactory; protected $table = 'candidats'; protected $fillable = [ 'nom', 'prenom', 'email', 'adresse', 'date_naissance', 'telephone', 'cin', ]; public function documents() { return $this->hasMany(document::class); } CandidatController public function show() { $candidat = candidat::all(); return view('candidat.liste', compact('candidat')); } candidat/liste :

file_exists return false when file exist

صورة
I have tried if(file_exists(storage_path().'test.txt' )) { dd("YES, it's there."); }else { dd("Nope, it's not exist"); } I have test.txt in my storage folder. What did I missed ? from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3fZydgT via IFTTT

call_user_func_array() expects parameter 1 to be a valid callback, class 'Google\Client' does not have a method 'getVideoInfo'

I'm working with the Alaout and Dawson package, when I get the information, I get this error. I have tried to shorten the Facades but I still can't figure it out. Here is the controller with the function class VideoController extends Controller { /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $videos = Youtube::getVideoInfo('YbIkHQVpDJ8'); return view('content.videoindex', compact('videos')); } /** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3s91wCA via IFTTT

Make me this project in Laravel

I created this project in html, javascript, php. Now let me make it to Laravel. This is what happens when someone enters a value in the input box (code). After checking the code from the database, the name from the next column to this code will be valued in another input box (code name). HTML code here: <input type="text" name="ccode[]" id="target" class="td-size" autocomplete="off" onchange="get(this.value);"> <input type="text" name="cname[]" id="codename" class="td-size"> javascript code here: <script type="text/javascript"> function get(val){ $.ajax({ type: "POST", url: "ajaxData.php", data: 'ccode='+val, success: function(data) { $('#codename').css("font-weight","bold"); $('#codename&#

Relation still returning row even if data not exist in laravel

I have this query : $data=Booking::whereHas('service.user', function($query) use ($id){ $query->where('user_id', $id); })->get(); Here service.user relate to user, i want to return only those record from booking table where user_id exist in service.user relation but using this relation i'm still getting record from booking table when the user_id is not present in service.user relation. Can anybody suggest some solution. Thanks from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3lPyoPL via IFTTT

Perform where clause inside the Pivot Table on the whereHas

I have encountered an issue which I cannot perform where clause on the pivot table inside the whereHas eloquent function. my expected query is SELECT product.*,product_item.* FROM product LEFT JOIN product_item ON product.id = product_item.product_id AND product_item.item_id = ? WHERE product_item.product_id is null; Currently, I have 2 laravel eloquent mode such as Product and Item as well as 1 pivot table which called product_items. Product model model attribute: id, name, status, created_at **relation** public function items(){ return $this->belongsToMany(Item::class,'product_items'); } Item model model attribute: item_id, item_name, item_sku Product_Item pivot table table attribute: product_id, item_id, dt_added I have a function called getProductThatIsNotOccupiedByItem() inside the product model as below shown: public function getProductThatIsNotOccupiedByItem( return $query->when($id,function($query) use($id){ $query->where(function($query)

upload csv with dropzone and laravel 5.6

I´m traying to upload csv file to import data with dropzone, with out form. I can arrive to my function controller, but i´m traying send file to this controller and always formData it´s empty... I don´t know that i´m doing wrong. Maybe i´m not working correctly but i can show one example very symple for use dropzone. This it´s my actual code in my blade: html <div id="dropzone"> <div>Seleccionar fichero</div> <input type="file" accept=".csv" /> </div> js $(function() { $('#dropzone').on('dragover', function() { $(this).addClass('hover'); }); $('#dropzone').on('dragleave', function() { $(this).removeClass('hover'); }); $('#dropzone input').on('change', function(e) { var file = this.files[0]; var token = $(

Laravel command with options

I made a command with two options in laravel, first will transfer data and second will delete the data from source php artisan transfer:db --transfer --delete . The problem I am facing is if there is some error in my first option which transferring the data, it will still run the second option which in my case will delete the data. I wanted to know that if it possible to exit the whole command if any of them fails at some step from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3Axe1eh via IFTTT

laravel Process could not be started [Le chemin d'acc�s sp�cifi� est introuvable. when send mail

I use flutter for developement mobile application and in backend I use laravel, now when I try to register user then send mail I found this error in send mail. Process could not be started [Le chemin d'acc�s sp�cifi� est introuvable. code .env: MAIL_DRIVER= smtp MAIL_HOST=smtp.gmail.com MAIL_PORT=465 MAIL_USERNAME=my gmail MAIL_PASSWORD=my password MAIL_ENCRYPTION=tls MAIL_FROM_ADDRESS=my gmail MAIL_FROM_NAME="${APP_NAME}" code mail.php: 'mailers' => [ 'smtp' => [ 'driver' => env('MAIL_DRIVER', 'smtp'), 'transport' => 'mail', 'host' => env('MAIL_HOST', 'smtp.googlemail.org'), 'port' => env('MAIL_PORT', 587), 'encryption' => env('MAIL_ENCRYPTION', 'tls'), 'username' => env('MAI

How to display file names BEFORE submit in laravel?

I want to see the names of each file I uploaded to the form before clicking the submit button and with the option to remove it if I want, how do I do this in laravel? i'm using laravel 8 View: <div class="mb-3"> <label for="formFileMultiple" class="form-label" >Receita</label> <input class="form-control" type="file" id="formFileMultiple" name="files[]" multiple> </div> Controller: foreach ($request->file('files') as $files) { Document::create([ 'COD_TIPO_DOCUMENTO' => 1, 'NOME_DOCUMENTO' => $files->getClientOriginalName(), 'DS_CAMINHO_DOCUMENTO' => $files->store('orders'), 'DT_CADASTRO' => Carbon::now(), 'NOME_EXTENSAO' => $files->getClientOriginalExtension(),

Javascript and html stepper

Please i need help, i am creating dynamic stepper registration form, here is the error am facing. my dom switch to the last one created dynamically which is wrong. What i want to achive is, i want to have add one more step base on type of user choosen on the dropdown (accountType) here is my code below @push('style') <style> .stepwizard-step p { margin-top: 10px; } .stepwizard-row { display: table-row; } .stepwizard { display: table; width: 100%; position: relative; } .stepwizard-step button[disabled] { opacity: 1 !important; filter: alpha(opacity=100) !important; } .stepwizard-row:before { top: 14px; bottom: 0; position: absolute; content: " "; width: 100%; height: 1px; background-color: #ccc; z-order: 0;

Laravel 5 slow refresh waiting for blocked storage access requests from trackers

I've moved a laravel app form a domain to another. All works well but I noticed, after clicked on subitting a button, that it spend 20seconds to refresh the paige. During this the system is waiting for an external components (addthis.com, google ads etc..), end when solved the process in console I read the "Blocked: Storage access requests from trackers" message. I've setup session.php to 'same_site' => 'lax' (it was null..) but nothing happends. Do you have some idea? How to include safe url list as walk-artoud it ? Thanks from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3AmLJ5W via IFTTT

Laravel migration works on Linux but not on windows

When I try to run my Laravel migration on windows this is the migration file that fails on Windows but works on Linux. <?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateTenantOwnerBridgeTable extends Migration { /** * Schema table name to migrate * @var string */ public $tableName = 'tenant_owner_bridge'; /** * Run the migrations. * @table tenant_owner_bridge * * @return void */ public function up() { Schema::create($this->tableName, function (Blueprint $table) { $table->engine = 'InnoDB'; $table->increments('id'); $table->unsignedInteger('tenant_owner_id'); $table->string('tenant_id', 191); $table->unsignedBigInteger('primary_admin_id'); $table->index(["primary_admin_id"],

Permission navigation in vuejs + laravel?

I have a campaign list page. Now I want when the user logs in, if he doesn't have access to the campaign list page, it won't show the menu and won't allow access to that url ? Give me ideas. Thanks Update : My problem is similar to this: Router permission in vuejs + laravel? from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3xJmPMt via IFTTT

Laravel detect mass assigning

I have a model event defined on a model that each time a create a record I add the user's company id related to that record. All works fine but I'm mass assigning records through csv importation and I must set the company id set as null. How can I detect in Laravel when I'm massive assigning? This is my model event: protected static function boot() { parent::boot(); static::creating(function (Product $model) { $model->company_owner_id = session()->get('currentCompany.id'); }); } I've not done the controller's function that stores the records created through CRUD form neither the csv importer and both are strongly used by all the Laravel app so I have no chance to modify the importer or CRUD form. Before using the csv importer the $fillable attribute on the model wasn't defined. from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3CxgO91 via IFTTT

Why have to disconnect the sqlite database when deleting the sqlite file on the local server storage?

I want to delete the sqlite file that is on the local server storage after the file is uploaded to AWS S3 . But I'm having Resource temporarily unavailable error. unlink(storage_path('app/public/' . $sqliteFileName)); So I thought to disconnect the database first before deleting the sqlite file. And it worked without getting the previous error. DB::disconnect('sqlite_db'); unlink(storage_path('app/public/' . $sqliteFileName)); I'm using this code with Laravel API v.5.6 and sqlite v.3.x . Do you know the reason why disconnecting this database solved the problem? from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3fKONkN via IFTTT

how to markdown multiple email blade?

i have multiple email template blade view which i want to markdown but laravel defualt mail method have one build method like this /** * Build the message. * * @return $this */ public function build() { return $this->markdown('view-to-mail', [ 'messageBody' => $this->data['message'], ]); } but i have multiple email template like this mail1.blade.php mail2.blade.php mail3.blade.php i wnat to make all of them as markdown something like this public function build() { return $this->markdown('mail1.blade.php', [ 'messageBody' => $this->data['message'], ]); return $this->markdown('mail2.blade.php', [ 'messageBody' => $this->data['message'], ]); return $this->markdown('mail3.blade.php', [ 'messageBody' => $this->data['message'], ]); } how i can do

Laravel Summernote doesn't want to save tag

I have a problem here, I want to save a summary of the news that the user will create, I don't want if the user uploads an image, the tag will not be stored in the summary column, how do I do that? $content = $request->content; $dom = new \DomDocument(); $dom->loadHtml($content, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); $images = $dom->getElementsByTagName('img'); foreach($images as $k => $img){ $data = $img->getAttribute('src'); list($type, $data) = explode(';', $data); list($type, $data) = explode(',', $data); $data = base64_decode($data); $image_name= '/upload/'.time().$k.'.png'; $path = public_path() . $image_name; file_put_contents($path, $data); $img->removeAttribute('src'); $img->setAttribute('src', $image_name); } $description = $dom->saveHTML(); $summernote = new News(); $summer

Generic Model Based CRUD API Laravel

Is there a built in or library based way to implement generic Eloquent/Model based views in Laravel for simple CRUD endpoints? At the moment I am writing the logic for index, store, destroy, update manually, but all the code is essentially the same. e.g. public function destroy($id) { $customer= CustomerInfo::find($id); $customer->delete(); } I'm more used to Django and the DRF which implements a ModelViewSet class which handles all (most) of the logic for simple CRUD applications. from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2VCLjJC via IFTTT

Laravel MySQL SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry not solved

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry laravel, I have tried all solution on iternet. I am getting this error when adding new record, strang things is I am not getting this all time but error coming on every 2nd or 3rd record. This I start noticing after import data from Backup I have truncate table and create from migration, but after importing old records still same issue. Have tried resetting auto increment field. in controller I have tried 2 ways given below ''' $data = array( 'hospital_id' => $hospitalid, 'doctor_name' => 'newdoc', 'doctor_id' => $this->myGUID(), 'created_at' => NOW(), 'updated_at' => NOW(), 'status' => 0, 'slug' => $docslug ); $doctor_id = Doctor::create($data)->id; $doct = new Doctor(); $doct->hospital_id = $hospitalid; $doct->do

Class 'Doctrine\DBAL\Driver\PDOMySql\Driver' not found

I am learning Laravel 5 and ran into an error when renaming a column in a table. Created a migration: public function up() { Schema::table('messages', function (Blueprint $table) { $table->renameColumn('age', 'agee'); }); } I send a command for migration and I get an error: In MySqlConnection.php line 65: Class 'Doctrine\DBAL\Driver\PDOMySql\Driver' not found Tried reinstalling in this way: deleted record "doctrine/dbal": "^3.1", from composer.json file typed in the console: composer update typed in the console: composer require doctrine/dbal The package was reinstalled, but the error persisted. How to fix? from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3iw3aLe via IFTTT

laravel: fatal error: out of memory (allocated tried to allocate bytes)

enter image description here I am developing laravel application when any open any file then file not open and in response this crashing page are showing from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2Vnrk28 via IFTTT

Swagger UI Access - Failed to fetch CORS, Network Failure, URL scheme must be "http" or "https" for CORS request

Swagger UI Access - Failed to fetch CORS, Network Failure, URL scheme must be "http" or "https" for CORS request. I have my Laravel PHP application where API is hosted on https://site.example.com and I have Swagger UP API Doc hosted on https://api.example.com . when I try API on Swagger API it gives Failed to fetch Error error. Following is my swagger.json { "openapi": "3.0.0", "info": { "title": "AustransLogistics API Documentation", "description": "AustransLogistics API description", "contact": { "email": "admin@admin.com" }, "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.html" }, "version": "1.0.0" }, "servers": [ { "url": "https://www.austranslogistics.com.au/",

where to find the static get post put delete patch of laravel 5.x.x Route class?

in the api.php we can state routes like this Route::post('/test','TestController@test'); Route::get('/test2','TestController@test2'); Route::delete('/test3','TestController@test3'); but when I checked the Route Class Symfony\Component\Routing; I don't see any static post, get , delete, patch,put functions... where can i find this ? and how these static calls gets detected ? from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3AdbGFa via IFTTT

create link to view file in browser with laravel 5.6

i´m traying to create link for open file 'pdf' in browser with laravel 5.6. I´m using for upload files dropzone i´m uploading file ok, but when return path in my controller. My URL it´s: file:///C:/xampp/gds/public/storage/postventapedidos/GR-11479.pdf my app it´s in VPN with xampp server. This VPS have https, i don´t know if this it´s a problem i have this code in my controller: /** * FUNCTION TO SAVE ORDER WITH DEALER */ public function saveOrderDealerNumber(Request $request){ $adjunto = $request->file('attached'); if(isset($adjunto)){ $name = $adjunto->getClientOriginalName(); $result = $adjunto->storeAs('postventapedidos', $name, 's4'); return public_path('storage/postventapedidos/'.$name); }else{ return "Error al adjuntar recibo de envío, consulte al administrador del sistema"; } } in my blade i have this: $("#tableF

Terminate method in middleware in laravel

I wanted to define a case if a function return false in a terminate() method in laravel middleware so this is what I did $parsedData = $this->parse($request); if(!$parsedData){ dd("hello"); } the condition is running fine but when I am calling response it is not showing anything $parsedData = $this->parse($request); if(!$parsedData){ return Response::json(array( 'success' => false, 'info' => "error" ), 422); } \\ called the Response helper am I doing anything wrong in this case? from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3AgwZFF via IFTTT

Edit default pagination in vuejs?

I handle vuejs + laravel I Controller : public function listData (Request $request) { $currentPage = !empty($request->currentPage) ? $request->currentPage : 1; $pageSize = !empty($request->pageSize) ? $request->pageSize : 30; $skip = ($currentPage - 1) * $pageSize; $totalProduct = Product::select(['id', 'name'])->get(); $listProduct = Product::select(['id', 'name']) ->skip($skip) ->take($pageSize) ->get(); return response()->json([ 'listProduct' => $listProduct, 'total' => $totalProduct, ]); } In vuejs data() { return { pageLength: 30, columns: [ { label: "Id", field: "id", }, { label: "Name", field: "name", }, ], total: "", rows: [], currentPage: 1, }; }, created() { a