jeudi 28 décembre 2017

how to show project name in limited characters in Laravel?

I need show My laravel application project name with limited characters. that means as an example consider some project name contains more than 10 letters, then I need only show 10 characters.

My project name create controller is

public function store(Request $request)
    {
        $this->validate($request, [
            'name'     => 'required|min:3',
            'notes'    => 'required|min:10',
            'color'    => 'required',
            'group'    => 'required',
            'status'   => 'required'
        ]);

        $project = new Project;
        $project->project_name   = $request->input('name');
        $project->project_status = $request->input('status');
        $project->group          = $request->input('group');
        $project->color          = $request->input('color');
        $project->project_notes  = $request->input('notes');
        $project->user_id        = Auth::user()->id;

        $duplicate = Project::where('project_name',$project->project_name)->first();
        if($duplicate)
        {
            return redirect()->route('projects.index')->with('warning','Title already exists');
        }   

        $project->save();
        return redirect()->route('projects.index')->with('info','Your Project has been created successfully');

and project name showing blade file is

<div class="row">
             @foreach ($projects as $proj)
               <div class="col-md-3" style="border:3px solid {!!$proj->color!!};margin-left:5px;margin-bottom: 5px;">
               <h2><a href="/projects/">{!! $proj->project_name !!}</a></h2>

then how can I show only 10 charactors in My blade file?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2C69wxy
via IFTTT

Aucun commentaire:

Enregistrer un commentaire