Category : laravel-5.8

I want to create unique slug for same title. Example – www.xcv.com/ght-ghy/ Example 1 – www.xcv.com/ght-ghy-1/ Here is my controller code: public function addPostDetails(Request $request) { $postTitle = $request->postTitle; $postDesc = $request->postDesc; $postCat = $request->postCat; $postTags = $request->tagid; $tags = explode(",", $postTags); $postglobid = date(‘y’) . date(‘s’) . $postCat . rand(0000, 9999); $posturl = Str::slug($postTitle, ..

Read more

I have these request file to register a new customer, I want to be the response json when the validation fails, how can I do that? This is the request class <?php namespace AppHttpRequestsValidations; use AppHttpRequestsRequest; class RegisterCustomerRequest extends Request { public function authorize() { return true; } public function rules() { return [ ‘name’ ..

Read more

I have this code, but not working with the noted "FirebaseJWTExpiredException: Expired token in {directory_project}" $key = "abcde"; $jwt = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOiJhYmMiLCJqdGkiOiJkZWYiLCJpc3MiOiJnaGkiLCJuYmYiOiJqa2wiLCJleHAiOiJtbm8iLCJ1c2VySWQiOjF9.yCOvRr-BS46gjCqGiRiBxbw9o0_YCTPMWLmT7uUVPyM"; $decoded = FirebaseJWTJWT::decode($jwt, $key, [‘HS256’]); Laravel 5.8 Sourc..

Read more

I am using Laravel 5.8 the server quickstart example to send a user to Stripe to make a payment. I need to create a solution for users to buy credits. https://stripe.com/docs/checkout/integration-builder My HTML: <form class="d-none d-sm-inline-block form-inline mr-auto ml-md-3 my-2 my-md-0 mw-100 navbar-search"> <div class="input-group"> <div class="input-group-append"> <button id="checkout-button" class="btn btn-danger" type="button"> Buy Credits </button> ..

Read more

I have a "jobdesk.dat" file in the "{myproject} /media/jobdesk.dat" directory Content on jobdesk.dat: Jobdesk=Andy:Desktop Programmer|Michael:Web Designer|Felix:Graphic Designer How to import this .dat file into the project and how to read or parse the content I tried with the code it didn’t work <?php $file = fopen("media/jobdesk.dat", "r") or die ("Unable to open file!"); echo fread ..

Read more

I have this model: class Payment extends MyBaseModel { protected $table = ‘payments’; protected $with = [‘company’, ‘account’, ‘manager’, ‘block’, ‘network’]; protected $appends = [‘someAttribute’, ‘someOtherAttribute’]; … } In another model I have a relation that looks like this: public function payment() { return $this->belongsTo(‘AppPayment’, ‘payment_id’, ‘id’)->withTrashed(); } What I need is to be able ..

Read more

I am trying to install spatie laravel newsletter package but i am getting an error message Problem 1 – Root composer.json requires spatie/laravel-newsletter ^4.9 -> satisfiable by spatie/laravel-newsletter[4.9.0]. – spatie/laravel-newsletter 4.9.0 requires illuminate/support ^6.0|^7.0|^8.0 -> found illuminate/support[v6.0.0, …, 6.x-dev, v7.0.0, …, 7.x-dev, v8.0.0, …, 8.x-dev] but these were not loaded, likely because it conflicts with ..

Read more

I have a dropdown list that have returned value from another database table and also I have the empty text box with textarea that have a value returned from database table I Just want make a selected value from dropdown to be variable to input for textarea and make a variable of what I am ..

Read more

I’m using Laravel – VueJS for one of my projects. But I’m having an issue when clicking the browser back button. Let me elaborate on my point of concern. I’m using route params to send the data to the next route, as follows: this.$router.push({ name: ‘MY_ROUTE_NAME’ , params: { ‘param_one’ : this.param_one, ‘param_two’ : this.param_two, ..

Read more

I have this model file:- namespace App; use IlluminateDatabaseEloquentModel; class Observation extends Model { protected $fillable = [‘observation’, ‘recommendation’, ‘priority’, ‘report_asset_id’]; protected $appends = [‘facility’]; public function attachments() { return $this->hasMany(‘AppObservationAttachment’); } public function report_facility() { return $this->belongsTo(‘AppReportFacility’); } public function getFacilityAttribute() { return $this->report_facility()->facility; } } And this is my query code:- $observations = ..

Read more

This is content of api.php route file:- <?php use IlluminateHttpRequest; /* |————————————————————————– | API Routes |————————————————————————– | | Here is where you can register API routes for your application. These | routes are loaded by the RouteServiceProvider within a group which | is assigned the "api" middleware group. Enjoy building your API! | */ Route::post(‘login’, ..

Read more

In my Laravel-5.8 application, I have these four (4) tables: CREATE TABLE `my_classes` ( `id` int(11) UNSIGNED NOT NULL, `school_id` int(11) DEFAULT NULL, `class_name` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL, `class_head_id` int(11) NOT NULL, ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; CREATE TABLE `students` ( `id` int(11) NOT NULL, `student_code` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `school_id` int(11) NOT ..

Read more