Category «Laravel»

Install Larvel telescope for dev env

$ composer require laravel/telescope –dev Problem 1 – phpoffice/phpspreadsheet 1.5.2 requires ext-zip * $ sudo port install php72-zip   Problem 1 – dompdf/dompdf v0.8.2 requires ext-gd * $ sudo port install php72-gd php artisan telescope:install php artisan migrate php artisan telescope:publish After running telescope:install, you should remove the TelescopeServiceProvider service provider registration from your app configuration file. Instead, manually register …

How to fix Laravel/nova issue of mod_fcgid: ap_pass_brigade failed in handle_request_ipc function

from apache error log: [fcgid:warn] [pid 5577:tid 139792914306816] (32)Broken pipe: [client 131.203.140.1:53559] mod_fcgid: ap_pass_brigade failed in handle_request_ipc function,   From laravel storage error log: [2019-03-25 12:02:10] prod.ERROR: file_put_contents(): Exclusive locks are not supported for this stream {“exception”:”[object] (ErrorException(code: 0): file_put_contents(): Exclusive locks are not supported for this stream at /virtual/teamlocal-laravel-nova.devweb.co.nz/laravel/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:122) #0 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(2, ‘file_put_conten…’, …

How to fix “./composer.json” does not contain valid JSON

It something wrong in the composer.json file, check the config.platform  part: $ composer install [Composer\Json\JsonValidationException] “./composer.json” does not match the expected JSON schema: – config.platform : Array value found, but an object is required $ composer install[Seld\JsonLint\ParsingException] “./composer.lock” does not contain valid JSON Parse error on line 548: …-21T16:29:17+00:00″<<<<<<< HEAD======= ———————^ Expected one of: ‘EOF’, ‘}’, ‘:’, …

How to ignore everything in a directory except one sub folder or file

Here I want to ignore everything except the passport folder. You must exclude the vendor/ folder first(!/vender), then ignore everything ( /vendor/*) except the laravel folder itself(!/vendor/laravel), thenignore everything (/vendor/laravel/*) except the passport folder itself(!/vendor/laravel/passport/),: !/vender /vendor/* !/vendor/laravel /vendor/laravel/* !/vendor/laravel/passport/

How to update a column from another column and append an additional string or variable in Laravel

How to use Laravel update a column from another column and append an additional string or variable $path = ‘providerImages/’; $results = DB::table(‘provider_websites’) ->where(‘logo_name’, ‘NOT LIKE’, ‘%’ . $path . ‘%’) ->where(‘logo_width’,’>’,1) //->limit(1) ->update([‘logo_name’ => DB::raw(“CONCAT(‘” . $path . “‘,logo_name)”)]) ;

How to use ReactJS upload file in a update form send data to Laravel api backend

jsx: <form enctype=”multipart/form-data”>< input id=”photo” accept=”image/*” name=”photo” type=”file” /> js: handleFieldChange(event) { if ( event.target.type == ‘file’){ this.setState({ [event.target.name]: event.target.files[0] }) } else { this.setState({ [event.target.name]: event.target.value }) } } let formData = new FormData(); formData.append(“_method”, ‘PUT’); for (let key in this.state) { //console.log(this.state[key]); formData.append(key, this.state[key]); } //console.log(formData); return false; axios.post(`/api/xxxx`, formData) .then(response => { …

How to get all rows and ignore soft deleted using with() relationship by Laravel?

How to get all rows and ignore soft deleted using with() relationship by Laravel? ->with([ ‘provider’ =>function($query) { $query->withTrashed(); }, ‘builderPurchases’ => function ($query) Use($user, $startDate, $endDate) { $query->where(‘builder_id’, ‘=’, $user->builder_id) ->where(‘date_payment_received’, ‘>=’, $startDate) ->where(‘date_payment_received’, ‘<=’, $endDate) ; } ]) ->all();

How to add property/element to Laravel collection

// prepare api data for reactjs $new_data = collect([]); foreach ($sorts as $time=>$date) { $tmp_ary[‘num’] = $records[$date][‘num’]; $tmp_ary[‘date_formated’] = date(‘F Y’, strtotime($date)); $tmp_ary[‘earned’] = round($records[$date][‘earned’],2); $tmp_ary[‘used’] = $records[$date][‘used’]; $tmp_ary[‘total_points’] = round($totalPoints[$date],2); $tmp_ary[‘date’] = $date; //$new_data->put($date, $tmp_ary); $new_data->push($tmp_ary); }