mercredi 5 octobre 2022

I'm working on frontend and Backend is in php laravel, the string are getting truncate, I don't know why? [closed]

 <div class="overview_content">
     <p class="view_paras">
              {!!ucfirst( str_replace('</p><p>','<br>',$course->overview))!!}
                    
        </p>
  </div>

Code look like this -

This is the structure been followed.

And the result is like in image - enter image description here

For more clear code - enter image description here



via Chebli Mohamed

How to run Laravel 8 on MAMP?

I have this in my composer.json

"require": {
    "php": "^8",
    "alkhachatryan/laravel-web-console": "^3.3",
    "barryvdh/laravel-dompdf": "^0.9.0",
    "doctrine/dbal": "^2.10",
    "fideloper/proxy": "^4.2",
    "fruitcake/laravel-cors": "^1.0",
    "guzzlehttp/guzzle": "^6.3",
    "intervention/image": "^2.3",
    "laravel/framework": "^8",
    "laravel/tinker": "^2.0",
    "laravelcollective/html": "~6.0",
    "league/flysystem-aws-s3-v3": "~1.0",
    "pusher/pusher-php-server": "^4.1"
},

I'm trying to run my Laravel app via MAMP v6.6

I kept getting

Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.1.0". You are running 8.0.8. in /Users/laravel-app/vendor/composer/platform_check.php on line 24

macOS 12.3

php --version

PHP 8.1.8 (cli) (built: Jul 8 2022 10:46:35) (NTS) Copyright (c) The PHP Group Zend Engine v4.1.8, Copyright (c) Zend Technologies with Zend OPcache v8.1.8, Copyright (c), by Zend Technologie



via Chebli Mohamed

I want to upload word document and view data in a text box using laravel

I created a form that user can enter the data in a text box and generate word document. Now I want to upload a word document and view the data in a text box. how can I do that using php in Laravel?



via Chebli Mohamed

mardi 4 octobre 2022

Wrong date and time showed

With this line:

<td><% district.created_at %></td>

I'm getting this output:

2022-08-06T09:14:58.000000Z

It should be like this:

2021-12-30 13:19:22

The correct printout is from Laravel 5.3 and the wrong from Laravel 9. What could be the problem and how to correct?



via Chebli Mohamed

lundi 3 octobre 2022

Disable dropdown in Laravel Blade

I have this dropdown i want to make it read only or disable

 

tried disabled also

 

but i want to disable options only the option that is pre-selected should be saved in database, using readonly i can change the dropdown and using disable i can't get its value.



via Chebli Mohamed

dimanche 2 octobre 2022

Laravel modular not routes with module

I am using "artem-schander/l5-modular": "^2.1" in laravel 6 . Package successfully installed. Also created a module name Employee. when I hit url like

<a href="" >Employee</a>

route (App/Modules/Employee/web.php)

Route::group(['module' => 'Employee', 'middleware' => ['auth'], 'namespace' => 'App\Modules\Employee\Http\Controllers'], function () {

     Route::get('employee-list', 'EmployeeController@welcome');
});

It shows 404 Not Found . How can I link it with module route ?

If I use Route::get('employee/employee-list', 'EmployeeController@welcome'); Then shows Target class [App\Modules\Employee\Http\Controllers\App\Modules\Employee\Http\Controllers\EmployeeController] does not exist.



via Chebli Mohamed

samedi 1 octobre 2022

Searching with multiple tables in laravel

I have this search query

 $products = Product::query()
            ->where('name', 'LIKE', "%{$search}%")
            ->orWhere('slug', 'LIKE', "%{$search_any}%")
            ->where('status', 'Active')
            ->get();

i have user table which stores the user who listed the product and its relation is as follows

Product Model:

  public function user()
    {
        return $this->belongsTo(User::class);
    }

I have one field type in user table, i want if user enters search string matches type also then also all the products added by them should be returned i was trying this code but how can i combine both the queries

 $products = Product::query()
                ->where('name', 'LIKE', "%{$search}%")
                ->orWhere('slug', 'LIKE', "%{$search_any}%")
                ->where('status', 'Active')
                ->get();
 $productsAddedByUser = User::where('type', 'LIKE', "%{$search_any}%")->get();
// saved $productsAddedByUser result in this array $userIdarray
$productnew = Product::whereIn('user_id', $userIdarray)->get();

I want to combine both the results of $productnew and $products



via Chebli Mohamed